Showing on member profile
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #1
Showing on member profile
I have been working on upgrading a plugin from 1.4 (Show referrals on Profile) and i have it all fixed apart from one weird thing.

If I view my profile from this link:

http://www.leefish.nl/mybb/member.php?action=profile

Then I have zero referrals.

If I view my own profile via this link:

http://www.leefish.nl/mybb/user-1.html

Then it shows my referrals correctly.

Any idea what I may be doing wrong?

Plugin attached. EDIT: Download it on LEEFISH. Guests can download Smile

LINK: http://www.leefish.nl/mybb/forum-51-page-1.html


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 12-08-2010 09:51 PM by leefish.)
12-08-2010 03:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Showing on member profile
Your first link isn't valid (I get an error page).
I think you need a "uid" in the URL, eg:
http://ww.leefish.nl/mybb/member.php?act...http://ww.leefish.nl/mybb/member.php?action=pro
^ ...In which it shows me the same referrals as your other link.

My Blog
12-08-2010 03:56 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: Showing on member profile
I'm sorry, I think I was not clear (again) I have a link in the header - my profile - which is constructed to use this code:

Code:
<span><a href="{$mybb->settings['bburl']}/member.php?action=profile">My Profile</a></span>


A lot of mybb sites seem to use this construct for a profile link. When I click on that link (My Profile) THEN it gives the link below:

Code:
http://www.leefish.nl/mybb/member.php?action=profile


And that is when the referrals are not visible.

I would like to be able to share this update, but as so many sites are using this construct then it could be perceived as broken. Thats bad, so I was wondering how to make the plugin see that the link

Code:
http://www.leefish.nl/mybb/member.php?action=profile

is the same as

Code:
http://www.leefish.nl/mybb/user-1.html 



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 12-08-2010 05:29 PM by leefish.)
12-08-2010 05:17 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Showing on member profile
(12-08-2010 05:17 PM)leefish Wrote:  I'm sorry, I think I was not clear (again) I have a link in the header - my profile - which is constructed to use this code:

Code:
<span><a href="{$mybb->settings['bburl']}/member.php?action=profile">My Profile</a></span>


A lot of mybb sites seem to use this construct for a profile link. When I click on that link (My Profile) THEN it gives the link below:

Code:
http://www.leefish.nl/mybb/member.php?action=profile

But that's an invalid link as there's no uid in the URL.
It probably should be

HTML Code
<span><a href="{$mybb->settings['bburl']}/member.php?action=profile&amp;uid={$mybb->user['uid']}">My Profile</a></span>


But if you want the SEF/SEO URLs, you need to use get_profile_link somewhere, eg:

PHP Code:
$userlink = get_profile_link($mybb->user['uid']);



EDIT: okay, it looks like MyBB will fall back to the current user if no uid is supplied.
In which case, you'd retrieve the user ID through $uid.  In other words, replace $mybb->input['uid'] with $GLOBALS['uid']


My Blog
(This post was last modified: 12-08-2010 06:36 PM by ZiNgA BuRgA.)
12-08-2010 06:33 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: Showing on member profile
Thank you - that has fixed it - its weird though, as that OTHER link construct was/is definitely working...... But it only worked if it was the logged in user viewing the profile.

So if I clicked it - it showed my profile, but if another member of leefish used it it showed their profile. Anyway, I feel sure that this construct is better.

Thank you

Smile
(12-08-2010 06:33 PM)ZiNgA BuRgA Wrote:  EDIT: okay, it looks like MyBB will fall back to the current user if no uid is supplied.
In which case, you'd retrieve the user ID through $uid.  In other words, replace $mybb->input['uid'] with $GLOBALS['uid']

Interesting - if I use the $GLOBALS['uid'] construct then its the same as before - no referrals showing on profile via that "My Profile" link in the member block, whereas if I use the uid={$mybb->user['uid']} construct then referrals show on profile via "My Profile" link in the member block.


Attached File(s) Thumbnail(s)
   


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 12-08-2010 06:59 PM by leefish.)
12-08-2010 06:43 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Showing on member profile
If I wasn't clear, I was referring to changing the code in the plugin, from:

Code:
AND u.referrer = '".intval($mybb->input['uid'])."'

to

Code:
AND u.referrer = '".intval($GLOBALS['uid'])."'


My Blog
12-08-2010 07:42 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: Showing on member profile
Oh. Gosh I am thick.

yay - it worked Smile

Thank you


[Image: leelink.gif]
MYBB1.6 & XThreads
12-08-2010 08:35 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: