Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - thunderstrike

Pages: 1 ... 186 187 188 189 [190]
2836
Mine is auto-resizer. Not in every scripts we see this feature. :)

2837
Mods & Plugins (Releases & Support) / [MOD] - Profile invisible.
« on: July 28, 2007, 12:08:46 AM »
Hi, I would like to share my MOD to see if anyone would be interested. It allows users to put their profile invisible.

1 - When profile is invisible and another user try to view it, it will re-forward the request towards another user account.
2 - If all users account are invisible, it will re-forward to the index page (except for admins).

- Step 1.

In member.php file,

Find:

Quote
if ($user_row = get_user_info($user_id)) {
    $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;

replace with:

Quote
if ($user_row = get_user_info($user_id)) {
// Profile invisible.
      if ($user_row['user_id'] != $user_info['user_id'] && $user_info['user_level'] != ADMIN && defined('PROFILE_INVISIBLE') && PROFILE_INVISIBLE == 1 && $user_row['profile_invisible'] == 1) {         
          if (function_exists('get_profile_visible') && $visible_row = get_profile_visible($user_id)) {
              redirect("member.php?action=showprofile&" . URL_USER_ID . "=" . $visible_row['user_id']);                   
          } else {
              redirect($url);
          }
          unset ($user_id);
      }
      // End of profile invisible.
     
    $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;

- Step 2.

In includes/functions.php file,

add above ?> tag:

Quote
function get_profile_visible($user_id = 0) {
    global $site_db, $user_table_fields, $user_row;
    $user_info = 0;
    if ($user_id != 0 && $user_id != GUEST) {
       
        if (isset($user_row[$user_id]) && !isset($user_row['profile_invisible'])) {
           
            $sql_alter = "ALTER TABLE " . USERS_TABLE . " ADD profile_invisible TINYINT(1) DEFAULT 0 NOT NULL";
            $result = $site_db->query($sql_alter);
           
            if (isset($result) && isset($user_row['profile_invisible'])) {
                if (is_object($site_email) && !empty($site_email)) {
                    unset ($site_email);
                }
               
                if (defined('PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT') && PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT == 1) {
                    @include_once(ROOT_PATH.'includes/email.php');
                    $site_email = new Email();
                   
                    $sql_email_all_wanted_email_users = "
                   
                    SELECT " . get_user_table_field("", "user_name"). get_user_table_field(", ", "user_email") . "
                    FROM " . USERS_TABLE . "
                    WHERE " . get_user_table_field("", "user_level") . " >= " . USER . " AND " . get_user_table_field("", "user_allowemails") . " = 1

                    ";
                   
                    $result1 = $site_db->query($sql_email_all_wanted_email_users);
                   
                    if (isset($result1) && $site_db->get_numrows($result1) > 0) {
                        while ($user_email_info = $site_db->fetch_array($result1)) {
                            $user_name = $user_email_info[$user_table_fields['user_name']];
                            $user_email = $user_email_info[$user_table_fields['user_email']];                           
                        }
                       
                        if (isset($user_name) && isset($user_email)) {
                            $site_email->set_to(stripslashes($user_email));
                            $site_email->set_from(stripslashes($config['site_email'])); // Change this line with the email address of your choice IF ONLY it does not work from your admin settings (make sure to change BEFORE executing this MOD for the first time and to set the activation value from your constant file).
                            $site_email->set_subject($lang['profile_invisible_email_subject']);
                           
                            $site_email->register_vars(array(
                            "user_name" => trim($user_name),
                            "site_name" => trim($config['site_name']),
                            "site_email" => trim($config['site_email']),
                            "site_url" => format_url($script_url . "/index.php")
                            ));
                           
                            $site_email->set_body("profile_invisible_announcement", $config['language_dir_default']);
                            $site_email->send_email();
                        }
                    }
                }
            }
        }
           
        $sql = "
       
        SELECT DISTINCT " . get_user_table_field("", "user_id") . "
        FROM " . USERS_TABLE . "       
        WHERE " . get_user_table_field("", "user_level") . " >= " . USER . " AND profile_invisible = 0
        ORDER BY rand()
        LIMIT 1
       
        ";
       
        if ($user_info = $site_db->query_firstrow($sql)) {
            foreach ($user_table_fields as $key => $val) {
                if (isset($user_info[$val])) {
                    $user_info[$key] = $user_info[$val];
                }
                elseif (!isset($user_info[$key])) {
                    $user_info[$key] = "";
                }
            }
        }
    }
  return $user_info;
}               

- Step 3.

In includes/db_field_definitions.php file,

add above the ?> tag:

Quote
$additional_user_fields['profile_invisible'] = array($lang['profile_invisible'], "radio", 1);

- Step 4.

In includes/constants.php file,

add above the ?> tag:

Quote
// Profile invisible.
define('PROFILE_INVISIBLE', 1); // 0 to deactivate and 1 to activate.
define('PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT', 1); // 0 to deactivate and 1 to activate the email announcement for this feature to ALL users who has set their emails for allowance (once per install only).

For the PROFILE_INVISIBLE_EMAIL_ANNOUNCEMENT, this is for sending an automated email message (once) to all your users (must accept emails from your gallery). If this is set to '0', your users will not receive the email message.

- Step 5.

In lang/english/main.php file,

add above the ?> tag:

Quote
//-----------------------------------------------------
//--- Profile invisible -------------------------------
//-----------------------------------------------------
$lang['profile_invisible'] = "Make my profile invisible to others:<br /><span class=\"smalltext\"><b>(Note: This option disregards the administrators.)</span>";
$lang['profile_invisible_email_subject'] = "Profile invisible feature - added on your profile.";

- Step 6.

In lang/english/email folder, create file called: profile_invisible_announcement.html and place content inside:

Quote
Dear {user_name},

{site_name} gallery has intergrated a new feature called:

- Profile invisible.

This will allow you to hide your profile from other users.
Note: This feature disregards the ADMIN level since they
can still see your profile even when restricted.

Now, other users who will try to see your profile will
be forwarded 'randomly' to other accounts where other
users will NOT consider this new option.

Visit our URL: {site_url} and modify your profile setting
if needed.

If you have any questions regarding this feature, please
send an email to us at: {site_email} .
Your suggestions are important to us. We will reply as
soon as possible.

Regards.

{site_name} .

Remember, constant file must be configured when consider this file.

- Step 7.

In templates/your_template/member_editprofile.html file,

find:

Quote
<tr>
            <td class="row1"><b>{lang_invisible}</b></td>
            <td class="row1">
              <input type="radio" name="user_invisible" value="1"{user_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_invisible" value="0"{user_invisible_no} />
              {lang_no}
         </td>
          </tr>         

add below:

Quote
<tr>
            <td class="row2"><b>{lang_profile_invisible}</b></td>
            <td class="row2">
              <input type="radio" name="profile_invisible" value="1"{profile_invisible_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="profile_invisible" value="0"{profile_invisible_no} />
              {lang_no}
         </td>
          </tr> 

- [2007-10-04 - Step 8]

With this MOD: http://www.4homepages.de/forum/index.php?topic=19254.0) -

add this (expert mode):

Code: [Select]
ALTER TABLE 4images_users ADD profile_invisible tinyint(1) NOT NULL default '0';

Hope you like it. :)

Cheers.

Pages: 1 ... 186 187 188 189 [190]