Welcome to the [HSX] website!

Been Gaming since 2003

Community Driven Site

Gaming, Web Development, and Support

  

 
Main Menu
 
DFG
 Home
 Join our Clan
 [HSX] Roster
 BF3 Stats
 Forums
 News
 Downloads
 News Letter
 Video tutorials
 Supporters
 Uploads
 F.A.Q
· FAQ
· Docs
· Forums FAQ
 [HS] History
 PHP Nuke Tools
 WhoIS Lookup
 Site Map
 Write a Review
 Image Repo
 Logout
DFG
DFG DFG DFG

 
[HSX] Donations
 
DFG
Donation
This here is a combined total of what we need to keep us going each month.

0 %

Donate

End DateJun 01
Target$50.00
Below Target$50.00
CurrencyUSD

Donators This Month
DFG
DFG DFG DFG

 
 Search our Site
 
DFG DFG
DFG DFG DFG

 
Theme Management
 
DFG


DFG
DFG DFG DFG

 
Survey
 
DFG What is your favorite game to play ATM?

WarThunder
World of Tanks
H1Z1
MechWarrior Online
ARK
WarFace
SWTOR
BattleField serier
COD Series
Diablo
Armored Warfare



Results
Polls

Votes 767
Comments: 0
DFG
DFG DFG DFG

 
Honey Pot
 
DFG
Bots in the pot!
We have [1433] bots stopped!

DFG
DFG DFG DFG

     
DFG HeadShot Extreme :: View topic - Forum groups causing blocks to show more any once?


Search for at
HeadShot Extreme Advanced Search

Forum groups causing blocks to show more any once?
Post new topic    Reply to topic    printer-friendly view   Thank Post    HeadShot Extreme Forum Index -> Nuke Blocks / Modules Support
View previous topic :: View next topic  
Author Message
[HSX]coRpSE
Top Dog
Top Dog
Nuke Dev / Coder
Nuke Dev / Coder



Clan Leader


This user has donated over $300 to the clan.

coRpSE
Currently Offline
Last Seen Online:
21 hrs, 59 mins ago

Most Played:
This week: 5.5hrs.
Total played: 1,053hrs.


  
Are you really commited?



  • » Show Info «


Status: coRpSE is offline
Post Posted: Wed Jul 18, 2018 10:11 pm Post subject: No icon Forum groups causing blocks to show more any once? Reply with quote

!!WARNING!!
Long post, don't skim, take time to read or don't read at all.


Here is what I am going to go over in this post, (in order),
  1. Explanation of whats happening and why.
  2. Send you to a video tutorial I did about forum permissions which I do talk about groups in it. (just  note, in the video I don't think i mentioned this, but if you set up groups like I said in there, this wouldn't be really an issue.).
  3. Little rant on how annoyed I am over this, mostly with those that lead me to believe they understood what i was talking about when they actually had no clue what I was talking about.
  4. Message to all that ask for my help.
  5. The code and what to edit
  6. How my code works, and explanation. Video just added.


Have you ran into a situation where you went to add a block onto your site, but you only wanted specific groups to see it, to you went in and set the block to groups only, and you selected a few groups, and after doing that, you find that there is multiple blocks now showing on your home page?

Well, if this has happened to you, and you came to me before and asked about it, then I probably told you to edit your groups to make it easier. I still stand by that. I don't get why a clan would set up something like, Leader, lieutenant, and members, and not put the leaders and lieutenant into the member group. Just say everyone in the clan was in the member group, then just say they got promoted to lieutenant, leave them in the member group, just add them to the lieutenant group. That way is you want something to be shown only to members, all you have to do is set the item to the members and that's it.

I do go over this in my forum permissions video tutorial.
Please login to see this link
Get registered or Log in


Well, I coded a workaround because some people that ask for my help choose to ignore it, or just didn't understand me, and when it effects them, they don't understand why even though they were told about it. I am not mentioning names, but, in the last week, this has popped up 4 times. Yes, that is right, four times. What I find strange is I haven't had anyone ask me about this issue for maybe a year, then I get it four times in 1 week.

Here is essentially what your would see if you run into this problem:
Expand

But from your admin panel it just was there once.
Expand

Well, it comes to light only when trying to set a block only for specific groups to see. Otherwise this goes unseen. If you set up the groups with careful planning knowing that this could happen, its easy to avoid, but, if you had no knowledge of this happening, it is easy to cause this issue with setting of the groups.
Expand

Well, finally I got around to coding a quick fix for this and I will explain my fix and how it works below. You can see the actual diffchecker here:
Check it out here:
Please login to see this link
Get registered or Log in


Here is the code to fix this issue:

Open up your public_html/mainfile.php

Find:
PHP:
        if (empty($blockrow[$i]['bkey'])) {
 
           if ( ($view == '0' || $view == '1') ||
 
              ( ($view == '3' AND is_user()) ) ||
 
              $view == '4' AND is_admin()) ||
 
              ( ($view == '2' AND !is_user())) ) {
 
               render_blocks($side$blockrow[$i]);
 
           } else {
 
               if (substr($viewstrlen($view)-1) == '-') {
 
                   $ingroups explode('-'$view);
 
                   if (is_array($ingroups)) {
 
                       foreach ($ingroups as $group) {
 
                           if (isset($userinfo['groups'][($group)])) {
 
                               render_blocks($side$blockrow[$i]);
 
                           }
 
                       }
 
                   }
 
               }
 
           }
 
       }
 
   }
 
   return;
 


Replace with:
PHP:
if (empty($blockrow[$i]['bkey'])) {
 
           if ( ($view == '0' || $view == '1') ||
 
              ( ($view == '3' AND is_user()) ) ||
 
              $view == '4' AND is_admin()) ||
 
              ( ($view == '2' AND !is_user())) ) {
 
               render_blocks($side$blockrow[$i]);
 
           } else {
 
               if (substr($viewstrlen($view)-1) == '-') {
 
                   $ingroups explode('-'$view);
 
                   if (is_array($ingroups)) {
                        
$cnt 0;
 
                       foreach ($ingroups as $group) {
 
                           if (isset($userinfo['groups'][($group)])) {
 
                               $cnt++;
                     
         }
                         
 }
                    if (
$cnt != 0){
                    
render_blocks($side$blockrow[$i]);
 
                       }
 
                   }
 
               }
 
           }
 
       }
 
   }
 
   return;
 


Save & Close


Now, you may see that I am having you replace more than the code that is necessary, and that's because I wanted to have you replace a whole section because it less likely that you may mess something up, especially with the count of the closing }'s.

Now, how does this work? Well, its simple. before hand, the code would check to see how many groups were called, and depending on how many time your appeared, would show the block once per group, so if you were in 4 groups, you would see it 4 times. Now, my code still uses the loop they had, but instead, does some simple math..

My code:
PHP:
                    if (is_array($ingroups)) {
                        
$cnt 0;
 
                       foreach ($ingroups as $group) {
 
                           if (isset($userinfo['groups'][($group)])) {
 
                               $cnt++;
                     
         }
                         
 }
                    if (
$cnt != 0){
                    
render_blocks($side$blockrow[$i]);
 
                       }
 
                   
 


First thing you will see is $cnt = 0;. What I am doing there is setting a variable that I created to be 0. So, at that point, if I wanted to display that variable using a echo or something, it would just show the number 0. Now, the next line down is the foreach, that is the loop that is taking the array of all the groups and looping thought each one.

The next line down is checking to see if you belong to the group that this block should be shown to. If you do, then the, next line down adds a 1 to the variable I created before that was equal to 0. So, each time the $cnt++; is run though the loop, lets say 3 times, then it added a "1" three times, (0+1+1+1=3).

So, the last part of my code is this:
if ($cnt != 0)
which is saying, it the variable $cnt does NOT equal to 0, then show the block once. So it doesn't matter how may groups you belong in, as long as your count is over 0 to be able to see it, then you will, otherwise, you wont see it.

Simple fix. I know there are other ways that this could have been accomplished, and short of a rewrite of sorts, this was the easiest way. So if your looking at putting this in, then the instructions are above, and exactly how the code works has also been explained.

Here is a video I finally got made:

[Watch On YouTube]


Learn more about Comparison Operators:
Please login to see this link
Get registered or Log in


Learn more about Incrementing / Decrementing Operators:
Please login to see this link
Get registered or Log in
Back to top
View user's profile Send private message Visit poster's website
HeadShot Domain, Been in buisness for over 10 years...
SoCo
NOOB!!!
NOOB!!!







  • » Show Info «


Status: SoCo is offline
Post Posted: Thu Jul 26, 2018 1:00 am Post subject: No icon Re: Forum groups causing blocks to show more any once? Reply with quote

Yeah, sorry bud about fucking up. You know I am not grat at listening and following instructions. Heck, I'm lucky that my wife has not left me yet. Thanks again for fixing our site again and I will try following instructions a bit better
Back to top
View user's profile Send private message
HeadShot Domain, Been in buisness for over 10 years...
[HSX]coRpSE
Top Dog
Top Dog
Nuke Dev / Coder
Nuke Dev / Coder



Clan Leader


This user has donated over $300 to the clan.

coRpSE
Currently Offline
Last Seen Online:
21 hrs, 59 mins ago

Most Played:
This week: 5.5hrs.
Total played: 1,053hrs.


  
Are you really commited?



  • » Show Info «


Status: coRpSE is offline
Post Posted: Thu Jul 26, 2018 1:11 am Post subject: No icon Re: Forum groups causing blocks to show more any once? Reply with quote

It's no problem, The day I wrote this "originally", I was having a bad day, but I also couldn't believe that I had 3 clans that had the same issue, and you and one other I talked to directly and helped on TS. Granted the other one did also just have some internal issues with their clan and there "web" guy.

But like I said to you, if you still don't understand what I am talking about, even after I explain, ask questions. It's the only way you or anyone reading this thread is going to learn. I know for a fact that I am going to run into these issues again, since this is not the first time. I actually banned a member of our clan from doing any work on his PC. He couldn't even install a mod or a game without me being connected. I just got tired of fixing his PC. lol...


 
Back to top
View user's profile Send private message Visit poster's website
HeadShot Domain, Been in buisness for over 10 years...
Sponsor
SoCo
NOOB!!!
NOOB!!!







  • » Show Info «


Status: SoCo is offline
Post Posted: Thu Jul 26, 2018 1:18 am Post subject: No icon Re: Forum groups causing blocks to show more any once? Reply with quote

Yeah, my bad.

Well, thanks again for what you did for us and keep up what your doing for this community. We need more of you to keep doing this. you know I would help if I knew what I was doing.


 
Back to top
View user's profile Send private message
HeadShot Domain, Been in buisness for over 10 years...
[HSX]coRpSE
Top Dog
Top Dog
Nuke Dev / Coder
Nuke Dev / Coder



Clan Leader


This user has donated over $300 to the clan.

coRpSE
Currently Offline
Last Seen Online:
21 hrs, 59 mins ago

Most Played:
This week: 5.5hrs.
Total played: 1,053hrs.


  
Are you really commited?



  • » Show Info «


Status: coRpSE is offline
Post Posted: Thu Jul 26, 2018 12:05 pm Post subject: No icon Re: Forum groups causing blocks to show more any once? Reply with quote

n/p


 
Back to top
View user's profile Send private message Visit poster's website
HeadShot Domain, Been in buisness for over 10 years...
Display posts from previous:
Post new topic   Reply to topic   printer-friendly view   Thank Post HeadShot Extreme Forum Index ->  Nuke Blocks / Modules Support All times are UTC - 7 Hours [DST enabled]
Page 1 of 1
 


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Announcement: Clan Wars Map Exhibition: Northwest 3 dwpred18 2378 Fri Feb 07, 2014 1:10 am
dwpred18 View latest post
No new posts Announcement: clan wars 0 dwpred18 783 Mon Jan 27, 2014 1:12 pm
dwpred18 View latest post
No new posts Announcement: Clan Wars Campaigns Announcement 2 dwpred18 1246 Fri May 24, 2013 9:17 pm
Spartacus1968 View latest post
No new posts first ever World of Tanks clan tournament! 2 Biteme 2265 Mon Apr 04, 2016 11:47 pm
PLISKEN View latest post
No new posts Clan Roster 15 skully 2547 Mon Feb 29, 2016 3:01 pm
coRpSE View latest post
 




Powered By: phpBB © 2001 - 2008 phpBB Group
SimpleBlack V2 By: killigan
© DarkForge Graphics 2008 - 2009 All Rights Reserved

Googlepage: GooglePullerPage
DFG
DFG DFG DFG
Forums ©
Copyright © HeadShotDomain 2016 By: coRpSE
SimpleBlack V2 By: Killigan
Powered By: Evolution-Xtreme