vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Help me, to edit this code! (https://vborg.vbsupport.ru/showthread.php?t=268474)

v123shine 08-13-2011 05:19 PM

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!

BirdOPrey5 08-14-2011 07:44 PM

Quote:

Originally Posted by v123shine (Post 2233091)
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.

v123shine 08-15-2011 08:02 AM

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!

BirdOPrey5 08-15-2011 11:58 AM

Quote:

Originally Posted by v123shine (Post 2233684)
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 :confused:

BirdOPrey5 08-15-2011 12:07 PM

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

v123shine 08-15-2011 12:31 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2233735)
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!

v123shine 08-18-2011 03:34 PM

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.

Lynne 08-18-2011 03:37 PM

Please post the datecode you had written that wasn't working.

v123shine 08-18-2011 05:13 PM

Dear Lynee

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

Quote:

Originally Posted by Lynne (Post 2234978)
Please post the datecode you had written that wasn't working.


BirdOPrey5 08-18-2011 05:17 PM

Quote:

Originally Posted by v123shine (Post 2233741)
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




All times are GMT. The time now is 03:52 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.03516 seconds
  • Memory Usage 1,748KB
  • 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
  • (4)bbcode_php_printable
  • (5)bbcode_quote_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