MyBB Community Forums

Full Version: UserCP issues after installing/removing PSN ID Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The title is as self-explanatory as I could get it.

A few weeks ago I installed the Playstation Network ID plugin on request from some of my board members, and after getting it installed (with a slight modification to the code based on my version compatibility), I've had nothing but issues.

After the initial installation, I noticed a slight graphics problem that I wanted to address, so I disabled the plugin and adjusted the data in the php file to include my updated graphics. Upon re-enabling the plugin, I found that instead of overwriting the data in the UserCP, the plugin appears to have added to it's pre-existing data. In an attempt to resolve the issue, I again disabled the plugin and then removed all traces of the files from my site, but the data still appears in the UserCP as if something exists (examples below).

How the contact info in the Edit Profile screen appears in the UserCP:
[attachment=27722]

How the View Proile screen appears:
[attachment=27723]

*Please note - Both of these screen shots were taken after the plugin had been disabled and all associated files removed from my server.


I would like to have some sort of plugin like this for my PSN users, but not at the cost of ruining the coding/look of my UserCP.

Any thoughts/suggestions on how I can resolve this?

For sake of ease in any troubleshooting, I've provided the original code for this plugin (with the compatibility modification made) below.

<?php

if(!defined("IN_MYBB"))
{
  die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("datahandler_user_update", "profilepni_update");

function profilepni_info()
{
  return array(
    "name"           => "Profile Playstation Network ID",
    "description"    => "Adds a Playstation Network ID to the User CP",
    "website"        => "http://www.xpresionzone.net/",
    "author"         => "Walkman 5.0",
    "authorsite"     => "http://www.xpresionzone.net/",
    "version"        => "1.0",
    "guid"           => "11c8d8bf95166e6eb737c23a9387a91b",
    "compatibility"  => "160*"
  );
}

function profilepni_activate()
{
  global $db;
  
  /* TODO: Should the possibility be added to disable pni from admin cp? */
  $db->query("ALTER TABLE ".TABLE_PREFIX."users ADD pni VARCHAR(200) NOT NULL AFTER msn");
  
  /* TODO: Language support? */
  require_once MYBB_ROOT."inc/adminfunctions_templates.php";

  /* Insert fields into usercp for editing */
  find_replace_templatesets('usercp_profile','#{\$user\[\'yahoo\'\]\}\" /\></td>#',
         '{$user[\'yahoo\']}" /></td>
</tr>
<tr>
<td><span class="smalltext"><img src="{$settings[\'bburl\']}/images/pni.png" alt="Playstation Network ID" title="Playstation Network ID" /> Playstation Network ID:</span></td>
</tr>
<tr>
<td><input type="text" class="textbox" name="pni" size="25" value="{$user[\'pni\']}" /></td>
</tr>');

  /* Insert fields into member profile */
  find_replace_templatesets('member_profile','#{\$memprofile\[\'msn\'\]\}</a></td>#',
        '{$memprofile[\'msn\']}</a></td>
</tr>
<tr>
<td class="trow2"><strong><img src="{$settings[\'bburl\']}/images/pni.gif" alt="Playstation Network ID" title="Playstation Network ID" /> Playstation Network ID:</strong></td>
<td class="trow2">{$memprofile[\'pni\']}</td>
</tr>');
}

function profilepni_deactivate()
{
  global $db;

  $db->query("ALTER TABLE ".TABLE_PREFIX."users DROP COLUMN pni");

  require_once MYBB_ROOT."inc/adminfunctions_templates.php";

  find_replace_templatesets('usercp_profile',
      preg_quote('#{$user[\'yahoo\']}" /></td>
</tr>
<tr>
<td><span class="smalltext"><img src="{$settings[\'bburl\']}/images/pni.png" alt="Playstation Network ID" title="Playstation Network ID" /> Playstation Network ID</span></td>
</tr>
<tr>
<td><input type="text" class="textbox" name="pni" size="25" value="{$user[\'pni\']}" /></td>
</tr>#'),
      '{$user[\'yahoo\']}" /></td>',0);

   find_replace_templatesets('member_profile',
        preg_quote('#{$memprofile[\'msn\']}</a></td>
</tr>
<tr>
<td class="trow2"><strong><img src="{$settings[\'bburl\']}/images/pni.png" alt="Playstation Network ID" title="Playstation Network ID" /> Playstation Network ID:</strong></td>
<td class="trow2">{$memprofile[\'pni\']}</td>
</tr>#'),
      '{$memprofile[\'msn\']}</a></td>',0);
}

function profilepni_update($pni)
{
  global $mybb;

  if (isset($mybb->input['pni']))
   {
      $pni->user_update_data['pni'] = $mybb->input['pni'];
   }
}
Remove all instances of this from usercp_profile template:

<tr>
<td><span class="smalltext"><img src="{$settings['bburl']}/images/pni.png" alt="Playstation Network ID" title="Playstation Network ID" />
Playstation Network ID:</span></td>
</tr>
<tr>
<td><input type="text" class="textbox" name="pni" size="25" value="{$user['pni']}" /></td>
</tr>
Frank:
Your recommendation removed all instances of the text boxes on the 'Edit Profile' screen, but the issue (the second screen shot in my OP) of the data still appearing on the 'View Profile' screen persisted.

I did some digging on the source for that, and found that there's additional coding that gets added into the member_profile template:

<tr>
<td class="trow2"><strong><img src="{$settings['bburl']}/images/pni.gif" alt="Playstation Network ID" title="Playstation Network ID" /> Playstation Network ID:</strong></td>
<td class="trow2">{$memprofile['pni']}</td>
</tr>
</tr>

Once I removed this additional coding, everything looks good.

Thanks for all the help with this issue, I greatly appreciate it.
No problem glad you got it sorted.