Resources

My Agape try

Your Agape try


Support Forum

Current User: Guest Login Register
Please consider registering

Search 
Search Forums:


 




Page Preview button doesn't work for Editor

UserPost

3:28 pm
May 22, 2009


nickpdx

Member

posts 5

1

I think this is a bug report, at any rate I can't figure out how to address it using the RoleScoper admin tools.  Seems similar to this:

http://agapetry.net/forum/role-scoper/unable-to-preview-posts/page-1?value=preview%251&search=1&ret=all

I have an Editor user who I want to edit only a certain Page and its sub-pages.  I set up RoleScoper by:

1. Page Restrictions, default Contributor/Editor/Associate to Restricted for all pages

2. go to the root Page in question, under Editors settings, selected "Restrict for Page" and "Restrict for Sub-Pages", picked out the user and saved.

I log in as that Editor user, and I can see the Page and all its subs in the admin list; I can edit the Page just fine.  But the Preview button doesn't work, I get shunted to my 404 template.

1:52 pm
May 25, 2009


Kevin

Admin

posts 1385

2

A confirmed bug; I'll plan to investigate it late next month.

9:07 am
May 26, 2009


nickpdx

Member

posts 5

3

Thanks Kevin, and if I track down the source of this behavior I will update this thread.

11:48 am
May 26, 2009


nickpdx

Member

posts 5

4

So the problem here, maybe, is that the + operator, when overloaded for array_merge(), will ignore values that share keys in the original array.  For example:

$array1 = array("foo");
$array2 = array("data");
$result = $array1 + $array2;print_r($result);

Output: Array ( [0] => foo )

Quick read over the array_merge() manpage wasn't very clear, in fact the manual appears to me to contradict this behavior entirely.  I'm on 5.2.4 fwiw, so maybe it's changed in 5.3 or something, although for the manual to reflect something from a release candidate/beta version or whatever it is, would be unfortunate.  Or the manual is just wrong.  Either one wouldn't surprise me.

I got to this point after reading the post linked above, checking those lines of code and finding that the result was not what it was apparently supposed to be.  Using array_merge() explicitly for those 3 assignments makes the 404 go away.  Since that looks like the original intent, I'll go with it for now.

defaults_rs.php, lines 275-279:

if ( ! empty($_GET['preview']) ) { $arr[$name]->usage->statuses->access_type['front'] = array_merge(array( 'draft', 'pending', 'future' ), $arr[$name]->usage->statuses->access_type['front']); $arr[$name]->reqd_caps['read']['post'] = array_merge(array ( 'draft' => array('edit_others_posts'), 'pending' => array('edit_others_posts'), 'future' => array('edit_others_posts') ), $arr[$name]->reqd_caps['read']['post']); $arr[$name]->reqd_caps['read']['page'] = array_merge(array ( 'draft' => array('edit_others_pages'), 'pending' => array('edit_others_pages'), 'future' => array('edit_others_pages') ), $arr[$name]->reqd_caps['read']['page']); }sorry about the formatting, if i put it in <pre> tags it blows up the page.

9:29 am
May 27, 2009


Kevin

Admin

posts 1385

5

Yes, that looks legit; I'll include it in the next release. Thanks for tracking it down.

7:12 am
July 3, 2009


Trem_r

Member

posts 7

6

Sorry but that still doesn't work for me, I'm using Role Scoper Version: 1.0.4.1 on WP 2.8, any user without admin role can't preview his page while editing, it doesn't redirect on a 404 but only on the current version of the page, not the edited one.

11:18 am
July 3, 2009


Kevin

Admin

posts 1385

7

Trem_r said:

Sorry but that still doesn't work for me, I'm using Role Scoper Version: 1.0.4.1 on WP 2.8, any user without admin role can't preview his page while editing, it doesn't redirect on a 404 but only on the current version of the page, not the edited one.


Do you have WP_POST_REVISIONS defined in wp-config.php?

I do, and it prevents Page Preview from working once the revision limit is reached (whether admin or non-admin, and whether RS is activated or not). When I remove that definition, the Page Preview works fine.

I also have another page which has upwards of 100 revisions stored, and it won't preview regardless of WP_POST_REVISIONS definition or RS activation/non-activation. So I'm really suspecting a WP autosave/revisioning issue here.

7:47 am
August 27, 2009


Trem_r

Member

posts 7

8

Do you have WP_POST_REVISIONS defined in wp-config.php?

I do, and it prevents Page Preview from working once the revision limit is reached (whether admin or non-admin, and whether RS is activated or not). When I remove that definition, the Page Preview works fine.

I also have another page which has upwards of 100 revisions stored, and it won't preview regardless of WP_POST_REVISIONS definition or RS activation/non-activation. So I'm really suspecting a WP autosave/revisioning issue here.


I just checked and I don't have WP_POST_REVISIONS defined in wp-config.php.

I also just updated RS to 1.0.8 and WP to 2.8.4 and the problem is still there, I can't preview if I'm not admin

9:43 am
August 27, 2009


Kevin

Admin

posts 1385

9

Is this a private page? How many revisions do you have stored? Does the problem occur even for newly published pages?

9:50 am
August 27, 2009


Trem_r

Member

posts 7

10

Kevin said:

Is this a private page? How many revisions do you have stored? Does the problem occur even for newly published pages?


It's the same on every page, they are all public, some have no revisions at all, some about ten or more, the problem occurs even for newly published page.

I don't know if it happens also during the creation of the page as my users don't have page creation rights, only edit rights.

11:08 am
August 27, 2009


Kevin

Admin

posts 1385

11

Trem_r said:

I don't know if it happens also during the creation of the page as my users don't have page creation rights, only edit rights.


Can you tell me how you have the Restrictions and Roles set up for those users?

1:56 am
August 28, 2009


Trem_r

Member

posts 7

12

Here is a screenshot of the capabilites of a generic user, I gave them on a page by page basis the "Page Author" Role in order for them to only see and edit their specific assigned page on the WP backend :

Everything works fine except for the preview.

Pending revisions are off, Caching is off

Thanks a lot for your help

7:08 am
August 28, 2009


Kevin

Admin

posts 1385

13

Trem_r said:

Here is a screenshot of the capabilites of a generic user, I gave them on a page by page basis the "Page Author" Role in order for them to only see and edit their specific assigned page on the WP backend…


What is the generic user's basic blog-wide WordPress Role (Subscriber / Contributor / Author)? Have you customized that role definition using Role Manager or Capability Mananger?

7:30 am
August 28, 2009


Trem_r

Member

posts 7

14

The generic users are Subscriber, but I have one Contributor with the same credentials for testing purpose and it can't preview either.

I must admit that I don't know exactly what you are talking about, I customized the Page Author definition by clicking on "Options" in the "Roles" menu, and "RS Role Definitions" and checking/unchecking what I needed.

Next, a user subscribes, becomes a Subscriber by default, I then edit the page(s) he needs to have access, go down to "Authors" , select "Users" panel, and check the name, update the page and everything goes smoothly (except for the preview of course !), he is finally a WP Subscriber site wide, but a Page Author on his page(s).

Also I'd like to thank you again for your concern and very fast answers, I hope it'll eventually help other RS users with the same problem, though !

8:21 am
September 7, 2009


Kevin

Admin

posts 1385

15

I've noticed that (even with stock WP), previewing doesn't work if the post/page is "currently being edited by another user". This has to do with WP's use of autosave to generate the preview.

I've also been told that if you define a custom value for 'AUTOSAVE_INTERVAL', the "currently being edited by another user" condition will also last that long. Haven't confirmed that myself yet.



Reply to Topic: Page Preview button doesn't work for Editor

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 1 + 11        (Required)

Topic Reply:


 

About the Agapetry forum

Currently Online:

7 Guests

Maximum Online: 88

Forums:

Groups: 2

Forums: 7

Topics: 694

Posts: 3177

Members:

There are 635 members

There are 1 guests


Kevin has made 1385 posts

Top Posters:

metal450 - 98

YikYak - 58

Ragnar - 36

Daisy - 35

victar - 33

Administrator: Kevin | Moderators: Kevin