AWSP - Add WebSite Permission (Partially Hook!)

Started by Hj Ahmad Rasyid Hj Ismail, September 13, 2010, 08:12:19 PM

Previous topic - Next topic

Hj Ahmad Rasyid Hj Ismail

Link to Mod

AWSP - Add WebSite Permission

- For SMF 2.0.x
- Partially using hook, minor modifications on one file.

1. Please do your own backup though every installation is backed up automatically.
2. By default, forum members are usually allowed to have their own website link with its title (advertised).
3. These websites links and titles are shown at memberlist, display (post), personal messsage, profile summary etc (are there any more?).
4. Some links and titles are anoying and forum admins / owners dislike this (or they want to charge some payment for them :P).
5. Using this mod added permission, forum admins / owners can decide which groups are allowed to have their website link(s).
6. This mod will automatically stop displaying members' website link with its title, if any, until permission is given.
7. You can test it in all lower SMF 2.0.x version too as IMO it should work just fine. ;)


Thank you for using/testing it.


Yours friendly,
Abu Fahim Ismail.

BSD License. Feel free to modify accordingly but keep original and current authors' link(s) if it is in there somewhere. ;)

Original Author: Joker™
Alternative Support Site: BurkeKnight Enterprises
Github link: ahrasis/AWSP-Add-Web-Site-Permission-Mod

 

#Change Logs

@Version 1.4.3
- Fix display in both classic and simple view in permission page.

@Version 1.4.2
- Fix permission from being displayed as an option in guest profile permission.
- Properly track and record all previous changes.
- Add github link.

@Version 1.4.1
- Author and license changed.
- Mod upgraded to partially hook.
- Remove previously created $context and simplify the code.

@Version 1.4.0
- Arantor's fix is now correctly applied.

@Version 1.3.0
- Try to fix permission by adding membersAllowedTo('permission') in Subs-Members.php as suggested here.

@Version 1.2.0
- Remove this bug.

@Version 1.1.0
- Add turkish language support.

@Version 1.0.0
- Initial release.


Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Matthew K.

I would also suggest adding some sort of template side edits.

What happens if I already have something in that field and then you toggle the permission? I will still have it filled out, it just won't show up when I go to edit my profile. You should have something in the displays that prevents it from even being displayed if the permission is not true.

Oya

Quote from: Joker™ on September 13, 2010, 10:23:58 PM
Quote from: Oya on September 13, 2010, 08:14:27 PM
btw this is part of http://arantormods.com/index.php?action=media;sa=item;in=1
is the code of that mod and my mod here is same ?

no but teh other mod i found does more and with one less eidt

fixing teh display would be ogod tho larbadoodle i havent really looked myself to see how easy tat'd be and arantor is well a bit bad tempered so i aint gonna sk him bout it

iPhoneDestek

#5
translatıon ın turkısh





<file name="$languagedir/ManagePermissions.turkish.php">
<operation>
  <search position="end" />
   <add><![CDATA[
// Permission Mod translation by SirtLanVadisi.net
    $txt['permissionname_add_website'] = 'Web Site Adressi ekleyebilir';
    $txt['permissionhelp_add_website'] = ' Üyenin Websitesi ve Adressi belirli yerlerde Forumda gösterilir.Profil alanında';
// End Permission Mod translation by SirtLanVadisi.net
   ]]></add>
</operation>
</file>
<file name="$languagedir/ManagePermissions.turkish-utf8.php">
<operation>
  <search position="end" />
   <add><![CDATA[
// Permission Mod translation by SirtLanVadisi.net
    $txt['permissionname_add_website'] = 'Web Site Adressi ekleyebilir';
    $txt['permissionhelp_add_website'] = ' Ãœyenin Websitesi ve Adressi belirli yerlerde Forumda gösterilir.Profil alanında';
// End Permission Mod translation by SirtLanVadisi.net
   ]]></add>
</operation>
</file>



$$  Q u a l i t y    I n f o r m a t i o n    L i n e  for iPhone $$



<   M O D  |  T R A N S L A T O R  |  TO  |  TUR  |  A N D   |  G E R   >


Joker™

#6
Quote from: Labradoodle-360 on September 13, 2010, 11:03:26 PM
I would also suggest adding some sort of template side edits.

What happens if I already have something in that field and then you toggle the permission? I will still have it filled out, it just won't show up when I go to edit my profile. You should have something in the displays that prevents it from even being displayed if the permission is not true.
i think it could be done fairly easily with put if condition in load.php . Editing template files is last option for me now , as i'm bit tired off providing support for different theme's . So, it is better to heck source files rather putting code in templates. I'll be updating mod about this very soon ;).

Quote from: Oya on September 14, 2010, 03:43:12 AM
no but teh other mod i found does more and with one less eidt

fixing teh display would be ogod tho larbadoodle i havent really looked myself to see how easy tat'd be and arantor is well a bit bad tempered so i aint gonna sk him bout it
I had a bit of tough time understanding that first :). Now as far as that mod is concern i've not seen the code , will take a look at it later . About the template file i've explained myself above already.

Quote from: ®SirtLan on September 14, 2010, 06:54:06 AM
translatıon ın turkısh


<file name="$languagedir/ManagePermissions.turkish.php">
<operation>
  <search position="end" />
   <add><![CDATA[
// Permission Mod translation by SirtLanVadisi.net
    $txt['permissionname_add_website'] = 'Web Site Adressi ekleyebilir';
    $txt['permissionhelp_add_website'] = ' Üyenin Websitesi ve Adressi belirli yerlerde Forumda gösterilir.Profil alanında';
// End Permission Mod translation by SirtLanVadisi.net
   ]]></add>
</operation>
</file>
<file name="$languagedir/ManagePermissions.turkish-utf8.php">
<operation>
  <search position="end" />
   <add><![CDATA[
// Permission Mod translation by SirtLanVadisi.net
    $txt['permissionname_add_website'] = 'Web Site Adressi ekleyebilir';
    $txt['permissionhelp_add_website'] = ' Ãœyenin Websitesi ve Adressi belirli yerlerde Forumda gösterilir.Profil alanında';
// End Permission Mod translation by SirtLanVadisi.net
   ]]></add>
</operation>
</file>

Thanks a lot bro , will add it shortly :).
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Matthew K.

Haha do you not think I am aware of that, Joker?

I said template side for a reason. Go ahead, try it Source end and see what you can do :) If you can successfully do it without causing *any* errors, go for it.

Joker™

Quote from: Labradoodle-360 on September 14, 2010, 11:01:34 AM
Haha do you not think I am aware of that, Joker?

I said template side for a reason. Go ahead, try it Source end and see what you can do :) If you can successfully do it without causing *any* errors, go for it.
Mod updated , do try and give the feedback :)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Matthew K.


Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Oya

dont work proply

if i set it so i dont have permisson i cant see any website links even from those who do have permisson to post tehm

Matthew K.

I should have noticed that...duh!

Here's your problem.
./Sources/Load.php
Code (Find) Select

'website' => (!empty($context['enable_website_url'])) ? array(
'title' => $profile['website_title'],
'url' => $profile['website_url'],
) : array('title' => '', 'url' =>''),

Code (Should be) Select
        'website' => ($context['enable_website_url']) ? array(
            'title' => $profile['website_title'],
            'url' => $profile['website_url'],
        ) : array('title' => '', 'url' =>''),


You don't need to find out whether $context['enable_website_url'] is empty or not; it's a permission that you put in a context for ease, but you still need to keep it in permission format when checking it.

Oya

no

that checks the *current* user permisson

not the permisson of the user whose profile ur checkin

Matthew K.

But that is in the user array, so it would.

Oya

no it wont

it doesnt load the permissons of every user whose avatar is displayed so it never checks that

u could even try it and see what happens

Matthew K.

allowedTo(''); checks for the user, not if it's checked or not.

Plus, it's in the array, so it should work how I quoted.

Oya

yes... the *current* user

so i have a new user  who doesnt have this permisson allowedto() returns false

because thats false for *him* it means he cant see *ANY* of the urls even mine and im the admin so i definately have permisson which isnt the same as hiding one he already put in when he did have permisson before

Joker™

#18
Quote from: Oya on September 14, 2010, 01:42:08 PM
dont work proply

if i set it so i dont have permisson i cant see any website links even from those who do have permisson to post tehm
thanks for reporting it , will try to remove the bug shortly :).
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

iPhoneDestek

translation in german





<file name="$languagedir/ManagePermissions.german.php">
<operation>
  <search position="end" />
   <add><![CDATA[
// Permission Mod translation by SirtLanVadisi.net
    $txt['permissionname_add_website'] = 'Kann Webseite Adresse zufügen';
    $txt['permissionhelp_add_website'] = 'Webseite und die URL der Nutzer im Forum und Profil angezeigt.';
// End Permission Mod translation by SirtLanVadisi.net
   ]]></add>
</operation>
</file>
<file name="$languagedir/ManagePermissions.german-utf8.php">
<operation>
  <search position="end" />
   <add><![CDATA[
// Permission Mod translation by SirtLanVadisi.net
    $txt['permissionname_add_website'] = 'Kann Webseite Adresse zufügen';
    $txt['permissionhelp_add_website'] = 'Webseite und die URL der Nutzer im Forum und Profil angezeigt.';
// End Permission Mod translation by SirtLanVadisi.net
   ]]></add>
</operation>
</file>





$$  Q u a l i t y    I n f o r m a t i o n    L i n e  for iPhone $$



<   M O D  |  T R A N S L A T O R  |  TO  |  TUR  |  A N D   |  G E R   >


Advertisement: