![]() |
Globalizing a Variable/Function
This is becoming a serious problem for me, as I need to find a way to have a certain function work on other areas of my board. The function is:
$prepared['isfriend'] It checks for friendship on the MEMBERINFO template, but not on any other page. What would I need to do in order to have it function on other pages. Any help or suggestions are welcome. |
Here's how I used it in my User CP Referrer hack to get the referrer name in the profile, it this helps at all:
PHP Code:
|
Thanks for your reply, I think I may have stumbled upon what I need, but am having no luck with the result.
Inside includes/functions.php I discovered the following lines: Line 1226: Code:
define('FETCH_USERINFO_ISFRIEND', 0x80); Code:
// no cache available - query the user Can anyone help me with this? |
Are you trying to get a list of friends or just for one user? You should be able to do a query for that, I would think.
|
No, actually I want to use the function to verify if the user is a friend, and if so, it would display the information accordingly.
For example: Code:
<if condition="$prepared['isfriend']"> |
Inside member.php, line 277, I found:
Code:
$fetch_userinfo_options = ( What else could I be missing in my plugin code that isn't allowing this function to run? I have tried including both these in my postbit template and neither appear: Code:
<if condition="$userinfo['isfriend']"> Code:
<if condition="$prepared['isfriend']"> |
Please post the entire plugin.
|
That's the problem, I don't have a plugin and need to create one but have no little idea as to what I should include in it. I'm positive I am using the correct hook, but the contents of my plugin are what I need help in creating. Here is all the code associated with my function in question.
This is found in functions.php, line 1248: Code:
function fetch_userinfo(&$userid, $option = 0, $languageid = 0) The location where it is functional now, only on the member.php includes the following code on line 277: Code:
$fetch_userinfo_options = ( The issue is my lacking ability to create a plugin for this function to work on other areas of my board, that's all. |
If you want to use the friend code on any other page then member.php, you will need to retrieve the data first.
Create a plugin that will retrieve it for the userid you need, something like: PHP Code:
PS If you plan to do this on posts, then please be aware that this can be very server intensive if you want to retrieve this for each post on a page. |
I think there was some confusion, or I am simply misinterpreting the code. Based on my understanding of plugin you created, I am to assume that it will fetch specific data (and display it) by using the $friendinfo function on a template.
This is not what I am looking for, as the content I wish to appear is already in the template, I simply want to restrict the content to only those permitted, in this case being the friends of the user. At the moment in my profile if i specify 'friends only', it will only show the content in the following conditional to only that users friends. Code:
<if condition="$prepared['isfriend']"> PHP Code:
PHP Code:
|
All times are GMT. The time now is 11:19 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|