Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2011, 05:19 PM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help me, to edit this code!

I want hide image from guest (unregister member) and i want register member can view the images in post/thread.

I make this simple plugin, and this plugin hide images from all member.

PHP Code:
{
$this->post['message'] = preg_replace("/<img.+?\>/i" "<img $1 />"$this->post['message']);



how to hide images only for guest and register user can view the image?

please help me!

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

help me, please!
Reply With Quote
  #2  
Old 08-14-2011, 07:44 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by v123shine View Post
I want hide image from guest (unregister member) and i want register member can view the images in post/thread.

I make this simple plugin, and this plugin hide images from all member.

PHP Code:
{
$this->post['message'] = preg_replace("/<img.+?\>/i" "<img $1 />"$this->post['message']);



how to hide images only for guest and register user can view the image?

please help me!

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

help me, please!
Are you in postbit_display_complete?

Try this:

PHP Code:
if ($show['guest'])
{
   
$this->post['message'] = preg_replace("/<img.+?\>/i" "<img $1 />"$this->post['message']);

That should run it only for guests.
Reply With Quote
  #3  
Old 08-15-2011, 08:02 AM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, great working

Yes, i make in 'postbit_display_complete'.

Is that a way to hide image from 31 december 2008 to 1 January 2011 for guest only?
if 2 january or 3 january guest can view the image.

Help me, please!
Reply With Quote
  #4  
Old 08-15-2011, 11:58 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by v123shine View Post
Wow, great working

Yes, i make in 'postbit_display_complete'.

Is that a way to hide image from 31 december 2008 to 1 January 2011 for guest only?
if 2 january or 3 january guest can view the image.

Help me, please!
I don'y get it, we're already well past January 2011
Reply With Quote
  #5  
Old 08-15-2011, 12:07 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh you mean by date of the post? That's not as easy- $post['dateline'] holds the timestamp of the post. You'll need to use the php date functions to turn your dates into timestamps and do the comparisons that way. http://php.net/manual/en/ref.datetime.php
Reply With Quote
  #6  
Old 08-15-2011, 12:31 PM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
Oh you mean by date of the post? That's not as easy- $post['dateline'] holds the timestamp of the post. You'll need to use the php date functions to turn your dates into timestamps and do the comparisons that way. http://php.net/manual/en/ref.datetime.php
Thank you so much BirdOPrey5 for help and respone my question.

Yap, i mean by date of the post.

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

Dear BirdOPrey5, i already try hundreds time, but still cant work

================================================== =

My new question is:

I want show image or image can view by all member (guest, register member, moderator, admin) if the post date above 1 March 2011.
If post date below the 1st of March 2011, all member can't view image.

Please help me!
Reply With Quote
  #7  
Old 08-18-2011, 03:34 PM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please help me!

I want show image to all my member group (guest, register member, moderator, admin) if the post date above 1 March 2011. If post date below the 1st of March 2011, all member group can't view any image.
Reply With Quote
  #8  
Old 08-18-2011, 03:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please post the datecode you had written that wasn't working.
Reply With Quote
  #9  
Old 08-18-2011, 05:13 PM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dear Lynee

I'm newbie in php, I dont know how to make that, can you help me, please!

Quote:
Originally Posted by Lynne View Post
Please post the datecode you had written that wasn't working.
Reply With Quote
  #10  
Old 08-18-2011, 05:17 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by v123shine View Post
Thank you so much BirdOPrey5 for help and respone my question.

Yap, i mean by date of the post.

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

Dear BirdOPrey5, i already try hundreds time, but still cant work

================================================== =

My new question is:

I want show image or image can view by all member (guest, register member, moderator, admin) if the post date above 1 March 2011.
If post date below the 1st of March 2011, all member can't view image.

Please help me!
OK well first you need the unix timestamp for that date. Since it's a static date that isn't changing we can get the actual timestamp rather than generate it with PHP-

I googled Unix Timestamp and the very first link was a calculator:
http://www.unixtimestamp.com/index.php

The timestamp for 0:0:00 hours on March 1, 2011 is: 1298959200

Therefore for your conditionals you will simply compare $post['dateline'] to the timestamp...

PHP Code:
if ($post['dateline'] < 1298959200//If the date is less than March 1, 2011
{
  
//run your code

Reply With Quote
Благодарность от:
Lynne
Reply

Thread Tools
Display Modes

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 08:13 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.09608 seconds
  • Memory Usage 2,267KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete