, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > General Support Requests > Article permission level

FlexCMS Support Forum


Article permission level
Started February 13, 2008 @ 12:45pm by David
Post Message 
David


Posts: 10
 
Article permission levelFebruary 13, 2008 @ 12:45pm
Hi,

I have a number of article teasers on one page that anybody can / should see, but want to limit the possibility to view the actual article to only registered users; and if they are not, they receive an error message "You do not have permission ...". Is there an easy way to set permission level to see article to > 0?

Thanks,
David
 

Last Edit: February 13, 2008 @ 12:52pm by David
DCSun
Administrator



Posts: 625
 
February 13, 2008 @ 5:11pm
David,

If you want all articles to behave the same, it's pretty straightforward:

inc-na-idx.php, line 36 should be "if ($Arguments2 == 'view') {". You could replace that with:
Code

if ($Arguments2 == 'view' && $UserLevel < 1) {
RedirectToLogin();
}
else if ($Arguments2 == 'view') {



If you want to allow viewing of some articles but not others, it's going to get more complicated.


David


FlexCMS v3.2 Has Been Released!
 
David


Posts: 10
 
February 14, 2008 @ 2:31am
This was perfect. Thanks. Only thing to keep in mind is that one might want to consider to modify the text on the login page so userrs understand whats going on.

Thanks again,
David
 
DCSun
Administrator



Posts: 625
 
February 14, 2008 @ 2:50pm
Yes, you have many options there. If you wanted to display a message instead of going straight to the login page you could use
Code

print "your message here";
in place of the "RedirectToLogin();" part.


David


FlexCMS v3.2 Has Been Released!
 
vfcweb


Posts: 6
 
articles permissions per article basis?July 31, 2008 @ 12:25am

Quote (DCSun)

David,

If you want all articles to behave the same, it's pretty straightforward:

inc-na-idx.php, line 36 should be "if ($Arguments2 == 'view') {". You could replace that with:
Code

if ($Arguments2 == 'view' && $UserLevel < 1) {
RedirectToLogin();
}
else if ($Arguments2 == 'view') {



If you want to allow viewing of some articles but not others, it's going to get more complicated.


David


how much more complicated? i think I would like to be able to do this...is this already covered somewhere else?

best,
heather
 
DCSun
Administrator



Posts: 625
 
July 31, 2008 @ 12:47am
Heather,

You could do it one of two ways - either with a new field in the database (na-Articles table), that identified the minimum permission level (the current user's level is stored in the $UserLevel variable - such as 1 for basic members, 100 for admins, etc) - or hard code the various article ID's into the inc-na-idx.php file.


David


FlexCMS v3.2 Has Been Released!
 
h


Posts: 17
 
articles with permissionJuly 31, 2008 @ 12:58pm
David~
The database option is doable to me as I am fairly comfortable with mySQLadmin. That said, I am sure that I can create a new field - but what to do after that? (yes, i am hogging your attention to teach me how to do things.)

any help is beyond appreciated. i am currently testing everything i can in the demo before getting the license and going live.

best,
heather
 
DCSun
Administrator



Posts: 625
 
July 31, 2008 @ 11:23pm
Heather,

There's really three parts to it;

1 - Min permission level stored somewhere (ie added field in db table)

2 - Ability to edit permission setting (either manually through the db, or alongside the rest of the article in the edit form)

3 - Determine whether person viewing article meets the min level required (in inc-na-idx.php)


Pretty busy with a myriad of things at the moment, but I'm happy to put something together for you if/when I get some free time. Entirely possible something like that will make it into a future version of FlexCMS too.


David


FlexCMS v3.2 Has Been Released!
 
h


Posts: 17
 
articles by permissionAugust 1, 2008 @ 12:49am
aha! you rule. sounds like a good project for me to learn on...and then see how you would do it whenever you get to it.

again, million thanks

~h
 
mrimen2004


Posts: 10
 
Viewable Articles By GuestsDecember 7, 2008 @ 3:57pm
I've created articles that I was non-registered guests to be able to view. I put the code into a page that will list each article in my specified group. However, when the non-registered guest clicks on the article for it to open it automatically kicks the user to my home page. Is there something restricting them from opening the actual article? Please help! Thanks.

Rich
 
DCSun
Administrator



Posts: 625
 
December 7, 2008 @ 4:14pm

Quote (mrimen2004)

Is there something restricting them from opening the actual article?


Maybe I'm missing something, but that's exactly what the code above was supposed to accomplish!

David


FlexCMS v3.2 Has Been Released!
 
mrimen2004


Posts: 10
 
Article permission levelDecember 7, 2008 @ 4:23pm
David,

Thanks for your reply. I checked the file that you specified and see the following code:

"if ($Arguments2 == 'view') {"

I would assume that each article should be able to be viewed by all but somehow, it's kicking guests out of the article and back to my home page instead of opening the full article.

On my group of articles, I have about 10 snippets that the viewer should be able to see and should be able to click on each to view the full article. It does show the list of 10 snippets with the compressed code, however, when the user clicks on the title of each snippet, he's kicked out.

Rich
 
DCSun
Administrator



Posts: 625
 
December 7, 2008 @ 4:50pm
Yes, that code is doing as it's supposed to. You'll see the line below that is "RedirectToLogin();", which is the part kicking them back.

Essentially that code in descriptive terms is "if viewing an article (the Arguments2 == 'view' part) and user is less than basic member level (the UserLevel < 1 part), then redirect them to the login page; otherwise show them the article".

If you want guest to be able to view all your articles, lose the code above that you added. It does exactly the opposite of what you wanted (the person it was written for didn't want guests to view the full articles).

If you do want some articles restricted, but others visible, you'll have to give it some way to tell which is which. The easiest if those 10 or so articles will always be the same, would be something like:
Code

if ($Arguments2 == 'view' && $Arguments3 != 4 && $Arguments3 != 7 && $Arguments3 != 10 && $Arguments3 != 11 && $Arguments3 != 12) {
RedirectToLogin();
}
else {

}
(with the numbers there being the numbers of the articles guests are allowed to view in full -- others not listed there would still be redirected back)

David


FlexCMS v3.2 Has Been Released!
 

Last Edit: December 7, 2008 @ 4:52pm by DCSun
mrimen2004


Posts: 10
 
December 7, 2008 @ 7:14pm

Quote (DCSun)

You'll see the line below that is "RedirectToLogin();", which is the part kicking them back.

Essentially that code in descriptive terms is "if viewing an article (the Arguments2 == 'view' part) and user is less than basic member level (the UserLevel < 1 part), then redirect them to the login page; otherwise show them the article".


There is nothing in that program using $UserLevel. I list the specific sponsors I want by have the following code in a page I created:

{FlexCMS-Articles|2|0,100|2}

As I walked through inc-na-idx.php, I think I may be past the part you're describing to me. I actually see the individual articles being listed, however, when I click on the article being displayed that should direct me to the actual article page,

<a href="'.$MainURL.'/articles/'.$row100['RecordNumber'].'.html">

that is when it seems to fail and kick guests back to the home page.

Rich
 
DCSun
Administrator



Posts: 625
 
December 7, 2008 @ 9:06pm
Lets go back a step and clarify something before we go any further. Since you posted in reply to a piece of custom code I presumed you had added that code to your site, is that correct?

David


FlexCMS v3.2 Has Been Released!
 
mrimen2004


Posts: 10
 
December 7, 2008 @ 11:57pm
David,

My mistake then. I didn't mean to reply to the custom code that you specified to the other user writing in. I was asking my own question that I'm experiencing. I added nothing to any code. I'm just having troubles viewing articles when they're clicked so I thought this was the place to write my message.
 
DCSun
Administrator



Posts: 625
 
December 8, 2008 @ 12:13pm
Did you make any changes to any source files on the site? Perhaps any code added to blocks on the site? I'm not aware of any problems like that with FlexCMS.

David


FlexCMS v3.2 Has Been Released!
 

Last Edit: December 8, 2008 @ 12:14pm by DCSun
mrimen2004


Posts: 10
 
December 8, 2008 @ 10:01pm
No changes that I'm aware of. I'll check with one other person that has done some customizing on our site to find out.

Richard
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.07673 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS