vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Question about calling PHP functions within a thread (https://vborg.vbsupport.ru/showthread.php?t=214667)

MoH672 05-27-2009 01:44 PM

Question about calling PHP functions within a thread
 
I want to be able to display information in a thread using PHP... I've figured out that I can't use PHP within the thread itself because it will not display, so I am using an iframe to call up the file which I am calling iframe.php.

This is the code I am currently testing:

PHP Code:

<?php
if ( $post[usergroupid] == ) {
    echo 
"<font face='Tahoma' size='4' color='#FFFFFF'>This is a test using iframes and 
php functions.</font>"
;
}
else {
    echo 
"<font face='Tahoma' size='4' color='#FFFFFF'>You do not have permission to 
access this page.</font>"
;
}
?>

Now, I am a member of Usergroupid 5 however it is displaying the else statement instead of showing me the info I want. Do I need to use some PHP command that links my statements? I am sort of figuring that the PHP doesn't know what $post[usergroupid] is, but I don't know how to link it to all the other vBulletin information.

Help appreciated!

Lynne 05-27-2009 02:20 PM

Is there a reason you are using an iframe instead of vbulletin's plugin system?

Also, you say you are doing this in a thread.... are you testing the usergroup of the person *viewing* the page (you - $bbuserinfo[usergroupid]) or the person who made each post ($post[usergroupid])?

MoH672 05-27-2009 02:40 PM

I am using an iframe because I didn't know I could use the Plugin system and I don't know how to use the plugin system.

Basically what I'm trying to do is restrict certain information within a thread to specific usergroups viewing it. If I am a member of 'usergroup a' I see information, if I'm a member of 'usergroup b' or 'c' or 'd' I see different information.

Lynne 05-27-2009 03:17 PM

I would use the plugin system - Plugin System. Also, check the Articles forum here for lots of good info on writing plugins.

I use the hook location "postbit_display_complete" to put stuff inside a particular post. It's not clear to me if you are talking about doing things to a postbit (each post) or something only on the top of the showthread page.

MoH672 05-27-2009 03:31 PM

Ok, I tried using the Plugin system.

I created a plugin for global_start with the following code:

PHP Code:

ob_start();
include(
'path/to/this/file/myfile.php');
$includedphp ob_get_contents();
ob_end_clean(); 

and then inserted $includedphp first in headerinclude and then in postbit but to no avail, my script keeps telling me I don't have access even though I am in the right usergroup. Thoughts?

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

Additionally, I will try to explain what it is I am trying to do.

I want to make a post on my forums. A user goes to that post and gets specific information based on his usergroup... however, someone in a different usergroup will simply see different information within that post.

Hope that helps.

Cryo 05-27-2009 03:35 PM

Can you elaborate on what sort of information they'll be seeing and give an example?

MoH672 05-27-2009 04:22 PM

At this point in time I'm not exactly sure, right now I am trying it with simple text... eventually I would want it to be able to possibly handle a database calculator for medical billing statistics where they would enter information in a field and see the calculated data at the end--and, depending on what subscription they have (and therefore what usergroup) they will see different calculators or multiple ones.

Lynne 05-27-2009 04:44 PM

Do you need this to be a post (a thread) or could you have an actual separate page that you create for this purpose?

MoH672 05-27-2009 04:53 PM

Yes I need it to be part of a thread, though only because that's how the logic of the forum is working out at the moment... people go to the forum based on to receive information in threads in specific forums, and it would be a little break in the logic if they went to another page just for this information. However if that's the only way to get it to work, I am prepared to do that instead.

Lynne 05-27-2009 05:02 PM

I'm just trying to get a picture of what it is you want. You want some stuff to show up on the top of a specific thread, or is it all threads, that is user specific or group specific? And you might want a form later on? Have you put together a quick image of what you think you want?


All times are GMT. The time now is 05:01 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
  • Page Generation 0.01170 seconds
  • Memory Usage 1,739KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete