Jump to content


jacmaes

Member Since 13 Dec 2011
Offline Last Active Today, 03:41 AM
-----

Topics I've Started

Page permissions for editor

18 November 2012 - 08:30 AM

I'm confused by how PW handles user permissions. I have created a user role of editor with the following permissions: edit, view and update profile.

This is an events website where the editor should be able to add and edit events and cities, but not other pages such as categories that are set once and for all. This is my page tree for the editor:

Attached File  tree.png   32.48K   68 downloads

There are a few problems here:
  • The editor should not be able to create new categories ("categorías")
  • The editor should not be able to create other pages at the top level, i.e. there should be no "new" next to "Inicio"
The "edit" and "view" permissions are all fine. For example, they should only be able to view the categories, and it works as expected. But it's the page creation permissions that I do not understand. This is the access tab in my "categories" template:

Attached File  categories.png   53.04K   68 downloads

In this setup, the editor should not be able to create pages, but it seems to apply only to the children of that template. If I undertand correctly, the page permissions are inherited from the home template, and for the editor to be able to create new events and add cities, I had to tick all the checkboxes (view, edit, create and add children) in the home template for the editor:

Attached File  home.png   48.48K   53 downloads

What am I doing wrong here? Or is this kind of fine-grained control not possible currently with PW?

Converting events website to PW

08 October 2012 - 07:31 AM

I'd like to convert an existing Website of mine (that does not use a CMS) to PW to be able to update it easily. Problem is, I don't know how to deal with more complex queries such as this one:

<?
$tomorrow = date('Y-m-d',mktime(0,0,0,date('m'), date('d')+1, date('Y')));

// Tomorrow's events
$query_tomorrow = "SELECT id, city, event, category, description, DATE_FORMAT(date_start,'%M %D') as datestart, DATE_FORMAT(date_end,'%M %D') as dateend FROM events WHERE disabled != '1' AND (
(date_start = '$tomorrow')
OR (date_start <= '$tomorrow' AND date_end >= '$tomorrow')
)
ORDER BY date_start DESC";
?>

I want to show tomorrow's events, so I'm selecting all events that I marked as active (disabled != '1', because they have not been cancelled for example) and that are either:
1. ongoing but will not end today,
2. or will start tomorrow.

How would I achieve the exact same query with PW?

Thanks in advance.

Error when inserting link from TinyMCE

26 September 2012 - 06:22 AM

I've just upgraded to the latest version of PW (from 2.2.3). Now I'm getting the following error whenever I try to insert a link to another page from TinyMCE:

Error Call to undefined method stdClass::attr() (line 56 of ....../public_html/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module)

In the Console Tab of Chrome's Web Inspector, there's the following error:
"Failed to load resource: the server responded with a status of 500 (Internal Server Error) ..../processwire/page/link/?id=1176&modal=1"

Searching and repeaters

25 September 2012 - 07:48 AM

In the "search.php" template that comes with the download of PW, this line allows you to search for "title", "body" and "sidebar" fields:

$matches = $pages->find("title|body|sidebar~=$q, limit=50");


But how do you search for content inside a repeater field?
Thanks.

Multi-author blog

12 July 2012 - 10:40 AM

I've been asked to consider the viability of the following project: a sort of collaborative blog where any Spanish expat could register and post small articles, videos and photos about their experiences as Spaniards living in the U.S. The trick here is that users should only have the options to view and edit their own posts, and should not have access to the posts of anyone else. I'm guessing then that the traditional user roles and permissions (user, editor, administrator...) do not apply here.

It must be the summer heat, but I can't think how to achieve this with Processwire. Any thoughts? As usual with PW, it must be easier than I think.