Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-15-2009, 12:31 AM
Diana13 Diana13 is offline
 
Join Date: Apr 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Link to member profile

Hi,

I want to modify the link of members from the home page (those with last posts) from http://www.example.com/forum/member....tposter&t=1652 to their profiles, eg www.example.com/forum/member.php?u=256

I've tried to modify in forumhome_lastpostby, but it didn't work, because I don't have $userinfo[userid] defined there.
Reply With Quote
  #2  
Old 07-15-2009, 02:12 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't do that easily. When someone clicks on the link, the forumid is passed and the lastposter *at that moment* is looked up and you are sent to their member.php page. The last poster can change between when a page is spit out and when a user clicks on that link.
Reply With Quote
  #3  
Old 07-15-2009, 10:02 AM
Diana13 Diana13 is offline
 
Join Date: Apr 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne. After I've read your post, I've made the following changes (I'm not a programmer so please don't laugh)

I've replaced in forumhome_lastpostby:
PHP Code:
<phrase 1="member.php?$session[sessionurl]find=lastposter&amp;f=$lastpostinfo[forumid]2="$lastpostinfo[lastposter]">$vbphrase[by_x]</phrase
width

PHP Code:
<if condition="$lastpostinfo[lastposter]">{
$sql "SELECT * FROM " TABLE_PREFIX " user WHERE username = '$lastpostinfo[lastposter]'";
$result mysql_query($sql) or die(mysql_error()); 
$userinfo mysql_fetch_array($result);}</if>

by <a href="member.php?$session[sessionurl]u=$userinfo[userid]">$lastpostinfo[lastposter]</a
But something is wrong, because instead of "by username_x" it displays the code between { and }.

Can somebody enlight me?

--------------- Added [DATE]1247658203[/DATE] at [TIME]1247658203[/TIME] ---------------

If nobody have a clue about the stuff above, maybe you can help me to solve another issue; in this case I don't need to solve the problem in the previous post.

I wanted different meta description and keywords for members. So I've made the following changes:

I've made a new plugin in global_start hook:
PHP Code:
if (THIS_SCRIPT == 'member'){
$sql "SELECT * FROM " TABLE_PREFIX " user WHERE userid = " $_REQUEST[u];
$result mysql_query($sql) or die(mysql_error()); 
$userinfo mysql_fetch_array($result);} 
I've added in headinclude:
PHP Code:
<if condition="THIS_SCRIPT == 'member'">
<
meta name="keywords" content="$userinfo[username]$vboptions[keywords]/>
<
meta name="description" content="$userinfo[username] is $userinfo[usertitle] in Forum" /> 
So now, when I call www.example.com/forum/member.php?u=234, the user profile displays right and have different description and keywords than other members.

But when I call, for example:
http://www.example/forum/member.php?...astposter&f=43

I have this message in a blank page:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

I thought that if I choose another hook for my plugin, it works. But which hook? I've tried different hooks but none of them was right.

Any clue on this?

--------------- Added [DATE]1247658982[/DATE] at [TIME]1247658982[/TIME] ---------------

Ok, while I wrote the above issue, I had an enlightened moment and I've solved the problem. I've changed the if statement:

PHP Code:
if (THIS_SCRIPT == 'member' && isset($_REQUEST[u])) 
Reply With Quote
  #4  
Old 07-15-2009, 02:18 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know why you should have to do any query. If you go to view Member X's member.php page, you should be able to use the variable $userinfo[username] to get Member X's username without doing any query. That variable should already be available for use.
Reply With Quote
  #5  
Old 07-15-2009, 03:52 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

They already have username, no? So why not do member.php?username=$lastpostinfo[lastposter]

Or if not, try lastposterid or lastpostuserid
Reply With Quote
  #6  
Old 07-15-2009, 04:46 PM
Diana13 Diana13 is offline
 
Join Date: Apr 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Lynne: I was able to use $userinfo[userid] in <title>, but in headinclude, for meta description and keywords, userinfo isn't available.

@Gio~Logist: the member's page is called with: member.php?u=$userinfo[userid]
I didn't find in any table the fields lastposterid or lastpostuserid. It would have been easier if there had been.
Reply With Quote
  #7  
Old 07-15-2009, 09:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Diana13 View Post
@Gio~Logist: the member's page is called with: member.php?u=$userinfo[userid]
I didn't find in any table the fields lastposterid or lastpostuserid. It would have been easier if there had been.
Gio is correct in that you can also call the member page using the username - member.php?username=xxxx so you may want to try his method.
Reply With Quote
  #8  
Old 07-16-2009, 03:43 AM
Diana13 Diana13 is offline
 
Join Date: Apr 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, it works. I can call a member like you said, but I have to do another changes to have username in description an keywords, so I'll leave my version.
Thank you all for your answers.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04603 seconds
  • Memory Usage 2,251KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete