Advertisement:

Author Topic: SMF Articles  (Read 302357 times)

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,699
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: SMF Articles
« Reply #980 on: May 06, 2018, 10:26:39 AM »
A nice system, but the permissions don't really play like SMF permissions usually do. I can not seem to be able to make a category that is viewable only by one membergroup.
At least I haven't found a way to do that.

To explain a bit further:
My permissions on the forum use allow, disallow and deny.
The membergroup permission to view in forum wide permissions is allowed for everyone, because this is a master setting for the articles page.
I have a membergroup X that I would like to give exclusive access to a category, regardless of that group being in primary or secondary group for the member.
So far I have not been able to find a combination of the permissions that would allow this. Either everyone gets in, or no one gets in. ( Well, I can limit out groups completely, like guests - but if I limit say group Y, and a member is in both Y and X he will not get in because Y is denied. )
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,185
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: SMF Articles
« Reply #981 on: May 06, 2018, 11:50:31 AM »
re. permissions

Edit the hooks file & replace the articles_load_permissions function with the following:
Code: [Select]
function articles_load_permissions(&$permissionGroups, &$permissionList, &$leftPermissionGroups, &$hiddenPermissions, &$relabelPermissions)
{
global $context, $modSettings;

$permissionList['membergroup'] += array(
'view_articles' => array(false, 'smfarticles', 'smfarticles'),
'add_articles' => array(false, 'smfarticles', 'smfarticles'),
'edit_articles' => array(false, 'smfarticles', 'smfarticles'),
'delete_articles' => array(false, 'smfarticles', 'smfarticles'),
'rate_articles' => array(false, 'smfarticles', 'smfarticles'),
'articles_comment' => array(false, 'smfarticles', 'smfarticles'),
'articles_auto_approve' => array(false, 'smfarticles', 'smfarticles'),
'articles_autocomment' => array(false, 'smfarticles', 'smfarticles'),
'articles_admin' => array(false, 'smfarticles', 'smfarticles'),
);

// SMF 2.1 branch behavior will differ
$version = version_compare((!empty($modSettings['smfVersion']) ? substr($modSettings['smfVersion'], 0, 3) : '2.0'), '2.1', '<') ? 'v2.0' : 'v2.1';

if ($version === 'v2.0')
{
$permissionGroups['membergroup']['simple'] += array(
'smfarticles',
);
$permissionGroups['membergroup']['classic'] += array(
'smfarticles',
);
}
else
$permissionGroups['membergroup'] += array(
'smfarticles',
);

}
« Last Edit: May 06, 2018, 12:03:44 PM by Chen Zhen »

My SMF Mods & Plug-Ins

WebDev
Simple Portal Support

Request politely & demand nothing.

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,699
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: SMF Articles
« Reply #982 on: May 06, 2018, 12:37:38 PM »
Thanks Chen Zhen, that looks like a promising suggestion - but sadly, the 2.0 install doesn't seem to use the hooks file..
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,185
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: SMF Articles
« Reply #983 on: May 06, 2018, 01:01:08 PM »

re. permissions

I'll give you a modified install file.
It's not my mod therefore I will not upload an updated package.

You'll have to unzip the package and replace the articles2.xml file with what is attached then re-zip the package and install it on your forum.
Report back and let us know if it resolves your issue.
If it does perhaps vbgamer will update his package with the fix.




My SMF Mods & Plug-Ins

WebDev
Simple Portal Support

Request politely & demand nothing.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,626
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: SMF Articles
« Reply #984 on: May 06, 2018, 01:02:27 PM »
Permissions I want to redo one day. Right now everything is allow all. And the only way to deny is deny each member group
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,699
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: SMF Articles
« Reply #985 on: May 06, 2018, 01:03:04 PM »
I'll take a look at it, thanks.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,699
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: SMF Articles
« Reply #986 on: May 06, 2018, 01:20:08 PM »
re. permissions
Okay, thanks for the effort - but comparing the original and your file, I'd be willing to guess this will have no effect.
That would only edit the part where ManagePermissions.php specifically states that it's completely optional to use.

Quote
// List of all the groups dependant on the currently selected view - for the order so it looks pretty, yea?
// Note to Mod authors - you don't need to stick your permission group here if you don't mind SMF sticking it the last group of the page.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,185
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: SMF Articles
« Reply #987 on: May 06, 2018, 08:08:16 PM »

The permissions for article categories have a unique table.

File: ../Sources/Articles2.php
function: MainView()

find:
Code: [Select]
if ($context['user']['is_guest'])
$groupid = -1;
else
$groupid =  $user_info['groups'][0];

// Set page title
$context['page_title'] = $mbname . ' - ' . $txt['smfarticles_title'];

$dbresult = $smcFunc['db_query']('', "
SELECT
c.ID_CAT, c.title, c.imageurl, c.filename, c.roworder, c.description, p.view 
FROM {db_prefix}articles_cat AS c
LEFT JOIN {db_prefix}articles_catperm AS p ON (p.ID_GROUP = $groupid AND c.ID_CAT = p.ID_CAT) 
WHERE c.ID_PARENT = 0 ORDER BY roworder ASC");
$context['articles_cat'] = array();
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
// Skip category if they do not have permission to view it
if ($row['view'] == '0')
continue;

$context['articles_cat'][] = $row;
}
$smcFunc['db_free_result']($dbresult);

replace with:
Code: [Select]
if ($user_info['is_guest'])
$groupid = array(-1);
else
$groupid = $user_info['groups'];

// Set page title
$context['page_title'] = $mbname . ' - ' . $txt['smfarticles_title'];
$dbresult = $smcFunc['db_query']('', '
SELECT
c.ID_CAT, c.title, c.imageurl, c.filename, c.roworder, c.description, p.view, p.ID_GROUP
FROM {db_prefix}articles_cat AS c
LEFT JOIN {db_prefix}articles_catperm AS p ON (p.ID_CAT = c.ID_CAT)
WHERE c.ID_PARENT = 0
ORDER BY roworder ASC'
);
$context['articles_cat'] = array();

while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
// List category if they have permission to view it
if ($row['view'] != '0' && ($user_info['is_admin'] || in_array($row['ID_GROUP'], $groupid)))
$context['articles_cat'][] = $row;
}
$smcFunc['db_free_result']($dbresult);

My SMF Mods & Plug-Ins

WebDev
Simple Portal Support

Request politely & demand nothing.

Offline Westwegoman

  • Jr. Member
  • **
  • Posts: 199
  • Gender: Male
    • westwegoman on Facebook
    • Westwegoman on LinkedIn
    • Bayou State Fishing
Re: SMF Articles (1.4 Released with SMF 2.0 support!)
« Reply #988 on: June 20, 2018, 08:47:32 PM »
Vb, it seems that when 'liking' an article and pasting an article link on facebook, it does not take you to the article itself, it posts the home page link instead.

I just recently noticed that pasting a link to an article in Facebook actually posts a link that brings up the home page also.

I searched through but didn't see a solution, unless I missed it.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,626
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: SMF Articles
« Reply #989 on: June 20, 2018, 09:45:33 PM »
It is probably do the url having a ; which SMF uses by default and Facebook does not like those characters.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Westwegoman

  • Jr. Member
  • **
  • Posts: 199
  • Gender: Male
    • westwegoman on Facebook
    • Westwegoman on LinkedIn
    • Bayou State Fishing
Re: SMF Articles
« Reply #990 on: June 20, 2018, 10:39:03 PM »
It is probably do the url having a ; which SMF uses by default and Facebook does not like those characters.

Ok thanks. I saw you had said that but didn’t know if a work around had been discovered.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,626
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: SMF Articles
« Reply #991 on: June 20, 2018, 10:52:58 PM »
Basically change the links to use & instead of ;
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Westwegoman

  • Jr. Member
  • **
  • Posts: 199
  • Gender: Male
    • westwegoman on Facebook
    • Westwegoman on LinkedIn
    • Bayou State Fishing
Re: SMF Articles
« Reply #992 on: June 20, 2018, 11:34:59 PM »
Basically change the links to use & instead of ;

How would one go about doing that?

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,626
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: SMF Articles
« Reply #993 on: June 20, 2018, 11:40:33 PM »
It would require opening the template files for articles and changed the url passed in the facebook code I believe
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline SMFHacks.com Team

  • Full Member
  • ***
  • Posts: 410
    • smfhacks on Facebook
    • @smfhacks on Twitter
    • SMFHacks.com
Re: SMF Articles
« Reply #994 on: February 13, 2019, 10:18:55 PM »
3.0.3b
+Added install support for SMF 2.1 RC1
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.

http://ForumRankings.net - Get Forum Ranked!
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store