Author Topic: [Code] Stop Users From Adding Their Own Profile To Their Friends List  (Read 912 times)

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 514
  • Karma: +45/-2
  • Etano Contributor (Skins & Mods)
Avoid users from adding their own profile to their friends and favorite lists.

Open processors > net_adduser.php

Simply add this block of code (i'd suggest around line 37 or 43)

Code: [Select]
if (!empty($_SESSION[_LICENSE_KEY_]['user']['user_id']) && $_SESSION[_LICENSE_KEY_]['user']['user_id']==$input['uid']) {
$error=true;
$topass['message']['type']=MESSAGE_ERROR;
$topass['message']['text']='You can not add your own profile!';
redirect2page('home.php',$topass);
}

What does it do?
It checks to see if the logged in users id matches the user the who their trying to add. If it matches then they'll get re-directed to home.php and a notice will inform them that "You can not add your own profile!" (you can change the notice to whatever you want it to say). If the user id does not match then everything will proceed as normal.

But how can they add their self in the first place?
1 - By direct link (simply copy and pasting the add link into a browser changing the users id to their own)

This isn't anything serious but thought it would be helpful

:)