vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need Help With My First Product (https://vborg.vbsupport.ru/showthread.php?t=183763)

Sema 06-28-2008 01:49 AM

Need Help With My First Product
 
Hello,,,

This is my first product :)

I am so excited about it :D

But I have a problem in it :(

The Product is to hide some Profiles and I tryed to do that in the plugin but it didn't work so I did it in MEMBERINFO Template.

I know what is wrong but I don't know what to do to fix it.

Code:

<if condition="$vboptions[on_off]">
<if condition="$userinfo['userid'] == $vboptions[profileid]">
standard_error('Sorry you are not allowed to view this profile')
</if>
</if>

The problem is in
PHP Code:

standard_error('Sorry you are not allowed to view this profile'

How can I fix that?

Dismounted 06-28-2008 04:56 AM

You cannot run PHP functions in templates.

Sema 06-28-2008 03:14 PM

As I said I know the problem but how can it show the error message because if I use the plugin it will not show the error.

I use this code:

PHP Code:

$on $vbulletin->options['on_off']; 
$hide $vbulletin->options['profileid']; 
$user $user[userid]; 

if (
$on){ 
if (
$hide !=""){ 
if (
$user == $hide){ 

standard_error('Sorry you are not allowed to view this profile'); 





Opserty 06-28-2008 03:25 PM

You can combine all of that into a single condition...
PHP Code:

if(($vbulletin->options['on_off']) AND (!empty($vbulletin->options['profileid'])) AND ($user['userid'] == $vbulletin->options['profileid']))
{
    
standard_error('Sorry...');


Are you sure [minicode]$user['userid'][/minicode] is the correct variable, maybe it should be [minicode]$userinfo['userid'][/minicode]?

Use print_no_permission()

Sema 06-28-2008 09:10 PM

I am just a newbie so combining would be a hard thing because I need to know where is the errors, but I can't make it better that what you did :)

I don't want to use
PHP Code:

print_no_permission() 

I thought about using it but the message is better to show the reason :)

I am not sure about
PHP Code:

$user['userid'

it dosen't work even with
PHP Code:

$userinfo['userid'

but it is used in the template MEMBERINFO

I don't think there should be template change because the plugin hook is member_start

MoT3rror 06-29-2008 02:57 AM

The current userinfo is
PHP Code:

$vbulletin->userinfo 

or in template
Code:

$bbuserinfo
On member.php the userinfo of the profile is
PHP Code:

$userinfo 


Sema 06-29-2008 03:38 AM

I used it like that

PHP Code:

if(($vbulletin->options['on_off']) AND (!empty($vbulletin->options['profileid'])) AND ($vbulletin->userinfo['userid'] == $vbulletin->options['profileid']))
{
    
standard_error('Sorry you are not allowed to view this profile');


But the problem is it is hiding the profile if the viewer id was = userid

What I want is to hide the profile from all members

ex.
If the page was
Code:

www.example.com/member.php?u=$vbulletin->options['profileid']
It will show the error message.

MoT3rror 06-29-2008 04:26 AM

PHP Code:

if($userinfo['userid'] == $vbulletin->options['profileid'])
{
//show error



Sema 06-29-2008 12:30 PM

I did try the code but it dosn't work :(

PHP Code:

if(($vbulletin->options['on_off']) AND (!empty($vbulletin->options['profileid'])) AND ($userinfo['userid'] == $vbulletin->options['profileid']))
{
    
standard_error('Sorry you are not allowed to view this profile');


For more than a week and I am doing my best to make it work and I try to do it more than 300 times ya realy more than 300 times :(

Dismounted 06-29-2008 12:55 PM

What hook are you putting it at?


All times are GMT. The time now is 03:26 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.01187 seconds
  • Memory Usage 1,754KB
  • 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
  • (3)bbcode_code_printable
  • (11)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