I have created two mods for SMF 2.0 (one is actually by Joker
) and am hoping to create the same in single addon here using hook technique. Any help, tips, guides will be much appreciated. I am looking at permission hook in ManagePermissions.subs.php and Profile.subs.php.
In SMF 2.0, I also hack into Load.php but there may be other ways to achieve the same here. The purpose of hacking into Load.php is to ensure that website url is considered empty if the permission has not been assigned to the membergroup but they must be able to see member's website and signature from the group allowed to have website and signature.
These two permissions will be a separate permission so the admin can choose whether they can have both or just any one of them.
The following code in Profile.subs.php will need to be unset or something before setting the new one.
'signature' => array(
'type' => 'callback',
'callback_func' => 'signature_modify',
'permission' => 'profile_extra',
'enabled' => substr($modSettings['signature_settings'], 0, 1) == 1,
'preload' => 'profileLoadSignatureData',
'input_validate' => 'profileValidateSignature',
),
'website_title' => array(
'type' => 'text',
'label' => $txt['website_title'],
'subtext' => $txt['include_website_url'],
'size' => 50,
'permission' => 'profile_extra',
'link_with' => 'website',
),
'website_url' => array(
'type' => 'url',
'label' => $txt['website_url'],
'subtext' => $txt['complete_url'],
'size' => 50,
'permission' => 'profile_extra',
// Fix the URL...
'input_validate' => create_function('&$value', '
if (strlen(trim($value)) > 0 && strpos($value, \'://\') === false)
$value = \'http://\' . $value;
if (strlen($value) < 8 || (substr($value, 0, 7) !== \'http://\' && substr($value, 0, 8) !== \'https://\'))
$value = \'\';
return true;
'),
'link_with' => 'website',
While this one, in Load.php, I dont know what to do with it yet. Manual modification is my original way. May be unset too?
'website' => array(
'title' => $profile['website_title'],
'url' => $profile['website_url'],
),
And this one too. I missed it.
'signature' => $profile['signature'],
And add some permission in using ManagePermissions.php. Let's see how this goes.
Edited. Add left out code to change in this add on.