Author Topic: {if user_image_uploaded} {endif user_image_uploaded}  (Read 12175 times)

0 Members and 1 Guest are viewing this topic.

Offline bigwillhere

  • Newbie
  • *
  • Posts: 22
    • View Profile
{if user_image_uploaded} {endif user_image_uploaded}
« on: February 28, 2008, 12:48:38 AM »
I just went through about 27 pages after doing a  keyword search on "endif" to look at some of the tags being used. Found some useful ones like:

{if user_loggedin} {endif user_loggedin}

The one I'm looking for does not exist or I could not find it.

Is there a tag I can use like above, but for members who are logged in but  have not uploaded an image.

Something like:

{if loggedin_user_image_uploaded}

some content

{endif loggedin_user_image_uploaded}

The reason I wanted this tag is to limit a logged in member who has not uploaded an image from using certain features.  After they upload an image, they have access to the feature.

I hope that made sense. Is there such a tag or can one be created. My php skills are almost zero.

Thanks for everyones help here. Thunderstrike has been outstanding and I appreciate the assistance.
« Last Edit: February 28, 2008, 02:00:51 AM by bigwillhere »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #1 on: February 28, 2008, 03:12:05 AM »
Hum ... yes ... is possible ... but where in template you like use this tag ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline bigwillhere

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #2 on: February 28, 2008, 03:57:14 AM »
Hey thunderstrike.

That tells you how much I know........I thought I could use it anywhere.  :lol:

 I guess I would want to use it mostly where a logged in members have access to other members contact information. My plan would be to wrap the IF statement around  code in templates that have other member's contact info so logged in members who did not upload their photo won't  see the contact info until they have uploaded a photo and it was validated by the admin

Did that make sense?

Thanks for replying.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #3 on: February 28, 2008, 04:10:28 AM »
Hum ... I no get why but I like this ...

Ok quick way is this:

// Step 1

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('get_upload_user_info')) {
   function get_upload_user_info($user_id) {
      global $site_db;
   
      $user_id = preg_replace("/[^0-9]+/i", "", $user_id);

      $sql = "

      SELECT COUNT(i.image_id) AS total_uploads
      FROM (" . IMAGES_TABLE . " i, " . CATEGORIES_TABLE . " c)
      LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
      WHERE i.image_active = 1 AND i.cat_id = c.cat_id AND " . get_user_table_field("u.", "user_id") . " = " . $user_id;

      $row = $site_db->query_firstrow($sql);
      $total_uploads = (isset($row['total_uploads'])) ? $row['total_uploads'] : 0;

      if (sizeof($total_uploads) > 0) {
         return $user_id;
      }
   }
}

// Step 2

In includes/page_header.php file,

find:

Code: [Select]
"user_loggedin" => ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) ? 0 : 1,

add line before:

Code: [Select]
"loggedin_user_image_uploaded" => (function_exists('get_upload_user_info') && get_upload_user_info($user_info['user_id'])) ? true : false,

In template (member_upload.html - e.g) try this:

Code: [Select]
{if loggedin_user_image_uploaded} ... {endif loggedin_user_image_uploaded}

replace ... for condition in template. ;)
« Last Edit: February 28, 2008, 04:57:12 AM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #4 on: February 28, 2008, 04:15:40 AM »
I fix step 1.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline bigwillhere

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #5 on: February 28, 2008, 04:31:13 AM »
Sorry, got this error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/asianlad/public_html/filipinalady/CLASS/includes/functions.php on line 1767

In step 1 not sure I understand where you want me to put it.

When you say top do you mean the top of the page after the opening "<?php" or did you mean to add before the closing "?>" (this is where I added it).

In step 2 when I searched for "user_loggedin" I found it in 3 places in page_header.php file - should I put the code before all three or just the first one?

Thanks

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #6 on: February 28, 2008, 04:38:04 AM »
Quote
you mean to add before the closing "?>" (this is where I added it).

If add before ?> - is good.

Quote
In step 2 when I searched for "user_loggedin" I found it in 3 places in page_header.php file - should I put the code before all three or just the first one?

If so ... I edit step 2 ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline bigwillhere

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #7 on: February 28, 2008, 04:40:58 AM »
Thunderstrike, I still get this error, even after you fixed step 1

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/asianlad/public_html/filipinalady/CLASS/includes/functions.php on line 1767

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #8 on: February 28, 2008, 04:42:01 AM »
Debugger is no reproduce this ...

1 - What PHP, mySQL version use ?
2 - What is say in line 1767 to 1770 ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #9 on: February 28, 2008, 04:57:35 AM »
I try new solution with step 1. Try again.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline bigwillhere

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #10 on: February 28, 2008, 05:04:13 AM »
Thunderstrike..........I got rid of the error. I didn't clear cache after I made the change to step 1 you fixed.

However, it did not work as expected.

 In step 3 I put wrapped the {if loggedin_user_image_uploaded} ... {endif loggedin_user_image_uploaded} around the email  in the member_profile.html because that is the only place I found where there was contact info (member's email). I didn't want to put it in the upload form. I still want member to upload his image, but until he does, I do not want him to contact other members.

Is it  because I put it in member_profile.html why it doesn't work.

I tested it 3 times just to be sure before I posted my findings.


Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #11 on: February 28, 2008, 05:12:40 AM »
Quote
In step 3 I put wrapped the {if loggedin_user_image_uploaded} ... {endif loggedin_user_image_uploaded} around the email  in the member_profile.html

Step 3 ? What step 3 ? I post step 1 and 2 ...

Quote
I didn't want to put it in the upload form.

Ok so no need for edit template for this. Only step 1 is need for this request.

In member.php file,

in showprofile action - find:

Code: [Select]
if ($user_row = get_user_info($user_id)) {

add after:

Code: [Select]
if (function_exists('get_upload_user_info') && !get_upload_user_info($user_info['user_id']) && $user_info['user_id'] != $user_id) {
   show_error_page(preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(trim($user_info['user_name']), 2), $lang['member_profile_no_uploads_find']));
}

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['member_profile_no_uploads_find'] = "Sorry <b>{user_name}</b>. No upload is find from you in gallery. Upload first for see profile.";
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline bigwillhere

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #12 on: February 28, 2008, 05:24:31 AM »
Thanks again, thunderstrike......it worked...........sorry about the step 3.............I was counting each step I took and didn't pay attention to what you wrote.

It works like a charm :)

I will explain now why to use.

When a member registers and joins, there is no incentive for them to upload a picture and yet they have access to other members contact info. By blocking them from other members contact info, this gives them the incentive to upload a photo so they can see contact info.

It also helps control spammers. Most spammers will register just to get contact info.  This way they can not get info..........granted they may still upload a photo and get info, but most spammers are too lazy to do so.  It won't stop them all, but every little bit helps.

Thanks again




Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #13 on: February 28, 2008, 05:25:24 AM »
One step more is need for this.

In member.php file,

find mailform action.

find:

Code: [Select]
if ($user_row = get_user_info($user_id)) {

add after:

Code: [Select]
if (function_exists('get_upload_user_info') && !get_upload_user_info($user_info['user_id']) && $user_info['user_id'] != $user_id) {
   show_error_page(preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(trim($user_info['user_name']), 2), $lang['member_profile_no_uploads_find']));
}
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: {if user_image_uploaded} {endif user_image_uploaded}
« Reply #14 on: February 28, 2008, 05:30:01 AM »
Quote
I was counting each step I took and didn't pay attention to what you wrote.

Is no problem but please read all instruction I post ...

Quote
It also helps control spammers. Most spammers will register just to get contact info.  This way they can not get info

Oh ... is just for email ? ... I create MOD in past for this:

- http://www.4homepages.de/forum/index.php?topic=18185.0
- http://www.4homepages.de/forum/index.php?topic=18193.0

topic no. 2 I think is request for you. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?