vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Link to member profile (https://vborg.vbsupport.ru/showthread.php?t=218601)

Diana13 07-15-2009 12:31 AM

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.

Lynne 07-15-2009 02:12 AM

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.

Diana13 07-15-2009 10:02 AM

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])) 


Lynne 07-15-2009 02:18 PM

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.

Gio~Logist 07-15-2009 03:52 PM

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

Or if not, try lastposterid or lastpostuserid

Diana13 07-15-2009 04:46 PM

@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.

Lynne 07-15-2009 09:17 PM

Quote:

Originally Posted by Diana13 (Post 1849341)
@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.

Diana13 07-16-2009 03:43 AM

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.


All times are GMT. The time now is 07:33 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01180 seconds
  • Memory Usage 1,749KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete