We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

plugin errors | Forum

Marcus
Marcus Feb 15
Not sure whether this returns object or array...


BOL_UserService::getInstance()->findByUsername($profileUserName);


I'm not in front of my pc so can't test it. 
The Forum post is edited by Marcus Feb 15
Marcus
Marcus Feb 15
Do this...

Find line 92 right which is this right. 

$profileUserId = BOL_UserService::getInstance()->findByUsername($profileUserName)->id;

Above ir add this.. 


print_r(BOL_UserService::getInstance()->findByUsername($profileUserName)) ;
exit;

Save and refresh any page tell me what you see... 



Senior Developer Leader
That's a NOTICE, not an error.


That logs says the profile they tried to navigate to, does not exist.


This may be caused when you delete a user and they try to access to that user's profile. Or when they try to access to an nonexistent profile url.


To fix this replace this line:


$profileUserId = BOL_UserService::getInstance()->findByUsername($profileUserName)->id;


With this 2 lines:

$oUser = BOL_UserService::getInstance()->findByUsername($profileUserName);

$profileUserId = ($oUser) ? $oUser->id : 0;


That should solve the NOTICE.


Senior Developer.

The Forum post is edited by Senior Developer Feb 15
OW-Ghost
OW-Ghost Feb 15

Thanks for the fix Senior Developer


Do admin have id 0 ? 


hmmmm....just want to know why it not find the admin id or what it is looking for...


i was check database and my admin id is = 1 


is that normal?


not sure how this plugin working. but it should hide admins for other members is the main goal


hmm interesting

The Forum post is edited by OW-Ghost Feb 15
OW-Ghost
OW-Ghost Feb 15
i worry my live site will go down ....hmm....what is this code doing that you send ?
Quote from Marcus Do this...
Find line 92 right which is this right. 
$profileUserId = BOL_UserService::getInstance()->findByUsername($profileUserName)->id;

Above ir add this.. 

print_r(BOL_UserService::getInstance()->findByUsername($profileUserName)) ;
exit;
Save and refresh any page tell me what you see... 



Senior Developer Leader
When they click on a link domain.com/user/username it checks if the "username" is a valid registered user, and if so, it gets the ID and then checks if the logged user is authorized to view this profile.


The NOTICE was that if they click on a link domain.com/user/nonexistentuser, the function was returning null, there is no ID for nonexistent users (cannot get ID from null), that was the NOTICE. In the new code we assign 0 as default value for nonexisting users to avoid this issue, that's the only thing we are doing in there.
This line of code, has nothing to do with if the user is admin or not, it is just getting the ID of the current profile url that is being accessed by everybody (before the authorization checking, the admin checking is in the code below that).


Senior Developer.


The Forum post is edited by Senior Developer Feb 15
Senior Developer Leader

Quote from OW_Ghost i worry my live site will go down ....hmm....what is this code doing that you send ?
Quote from Marcus Do this...
Find line 92 right which is this right. 
$profileUserId = BOL_UserService::getInstance()->findByUsername($profileUserName)->id;

Above ir add this.. 

print_r(BOL_UserService::getInstance()->findByUsername($profileUserName)) ;
exit;
Save and refresh any page tell me what you see... 



Don't do this in a production site, it will break the profiles page.


Senior Developer.

Senior Developer Leader


Quote from OW_Ghost

i was check database and my admin id is = 1 


is that normal?


Yes, it is normal.
OW-Ghost
OW-Ghost Feb 16
okey understand now much better :)


i learn php more when developer explain like this :)


thanks Senior Developer

Marcus
Marcus Feb 16
A little thanks would be nice you know. I'm done trying to help and not even getting some form of gratitude.

Good luck out. 
OW-Ghost
OW-Ghost Feb 16
thanks Marcus for the help


i try learn how to read code and it fun to learn :)

The Forum post is edited by OW-Ghost Feb 16
Ken
Ken Feb 16
If you just go to privacy and select only me on who can see my presence on this site done! That easy no coding modification required
OW-Ghost
OW-Ghost Feb 16

Quote from Ken If you just go to privacy and select only me on who can see my presence on this site done! That easy no coding modification required
i do that for only admin profile? or everyone?


but it is no good if later i want change that setting, then the issue still there.


hmmm but i think you right and maybe that was all that needed? 


but maybe the fix will cover if have any setting at all in privacy settings so better keep the fix?

OW-Ghost
OW-Ghost Feb 16
i was check my admin account and it is set to "only me" ?


i confused what you try to say

OW-Ghost
OW-Ghost Feb 16
update:


it was one "moderator" that have wrong privacy settings 


the moderator did have "everybody" on all


maybe thats why? i was only check admin account

OW-Ghost
OW-Ghost Feb 16
but if this is true why is not the plugin owner make clearly instructions for need have this settings for the plugin not send 100000000 notice in error log?


hmmm....very confused and not very logical build and user friendly when no instructions how to setup moderators and admins with privacy settings?

Ken
Ken Feb 16
Most of the old plugins are already exist on the new update 1.8.4 version and may need new touch ups here in there but follow oxwall GitHub periodically with the changes not just this forum
The Forum post is edited by Ken Feb 16
OW-Ghost
OW-Ghost Feb 16
okey so i not need this "hide admin" plugin you telling me?


But will the admins and moderators hide in skadate mobile apps is another question.


i need to test this first before i speak more about this...or maybe you know the answer?

The Forum post is edited by OW-Ghost Feb 16
Ken
Ken Feb 16
Most likely 1.8.4 was made for skaff app specif 
OW-Ghost
OW-Ghost Feb 16

Quote from Ken Most likely 1.8.4 was made for skaff app specif 
okey it would bee great if you could confirm, i lazy to check it right now :)
Pages: « 1 2 3 »