Comments

sreynen’s picture

Status: Needs review » Needs work

Just looking over the patch, it looks good. A couple small things I noticed:

  • Any instance of "* Implements of hook" should be changed to just "* Implements hook"
  • When removing hook_update_N() functions, I think you should add hook_update_last_removed().
crazyrohila’s picture

Title: First Patch on D6 version » Second code updation
StatusFileSize
new96.61 KB
new100.22 KB
new101.8 KB

I updated latest code in sandbox. The latest changes are working fine. I have installed og_panels in drupal7. Now the hook_menu() and node_load() have some issues, I am working on that. Ezra-g told me to check code of panelizer, I am doing so. Panelizer is soemthing high for my little understanding :P . I am trying to understand these "entity" and "handler" thing. This type of coding I see first time in a module .

I attached some screenshots of current status.

ezra-g’s picture

Thanks for the progress update!

It may make sense for us to schedule some time to go over this together, and before that for me to become more familiar with Panelizer at a code level.

In general, my assumption was that we could simply add to the list of og-specific permissions at admin/config/group/permissions, eg "Edit Panlizer settings for the group." That way, you could use the existing Panelizer settings for the group content type.

ezra-g’s picture

StatusFileSize
new110.78 KB

Here's how I would break down the problem here.

Our end goal is to grant group administrators the ability to use Panelizer on their group node.

It would be consistent to grant to group admins this ability the same way we grant them other privileges within the group: Through the Organic groups permissions form.

OG Permissions form

So, the first thing I looked for was this form in the codebase so that I could figure out how to add a checkbox to it for an "Access Panlzier for group homepage" setting.

I found my way to og_ui_admin_permissions() in og_ui.admin.inc where I saw:

543   // Get a list of all the modules implementing a hook_permission() and sort by
544   // display name.
545   $modules = array();
546   foreach (module_implements('og_permission') as $module) {
547     $modules[$module] = $module_info[$module]['name'];
548   }
549   asort($modules);

Looks like OG has an API we can use to define a new permission, using hook_og_permission().

So, looks like OG_Panels will want to implement that hook in order to get a setting onto this configuration form.

Then, we need to check that setting from within Panlizer so that Panelizer knows if the current user has permissions to access the Panlizer controls when viewing a group node. Note, we need to do this so that the permission is recognized both when using the In-place Editor and the "Panlizer" menu tab.

I'm not super familiar with writing Panelizer plugins - So far the first example of a Panelizer permission plugin I could find was in PanelizerEntityDefault.class.php.

I suggest starting with the OG plugin and getting it to the point where you've defined the permission and are able to check whether the current user is a group organizer for a particular group - Then you'll be halfway there and we can work on the Panelizer bit! We'll probably want to override panelizer_access() or access_admin().

[edited to remove incorrect information - my bad].

crazyrohila’s picture

Title: Second code updation » Panelizer patch to work as og_panels
StatusFileSize
new129.78 KB
new127.44 KB
new886 bytes

I created the panelizer patch to access the group admin. Now with this patch group admin can access the panelizer module and can panelize their home page.

Attached the patch and some screenshots of my local testing.

ezra-g’s picture

Great to see the functional progress here!

A few notes:

- If you're filing a patch against the Panelizer module, that patch needs to go in the Panelizer issue. I suggested posting here and *referencing* any patches in the issue queue of another module to make those patches easier for us to track and review in the queue of the other modules.

- I'm not sure you actually need to patch Panelizer here. As sreynen suggested in IRC and I mentioned in #4 above, you probably want to override panelizer_access().

Sreynen had pointed to the following example bit of code that would allow you to do this from within og_panels.module:

class someClass extends PanelizerEntityDefault {

  function panelizer_access($op, $bundle, $view_mode) {
   if (parent::panelizer_access($op, $bundle, $view_mode)) {
     return TRUE;
   }

   // do other checks here

  } 

}

I would expect that the Panelizer API would get you the $node object without you having to detect it from the URL -- I would be surprised if this is not the case. However, if we can't get the $node object from the Panelizer API, see Menu_get_object().

Looks like you've got the key conditional logic on its way here so you're close :)!

crazyrohila’s picture

Title: Panelizer patch to work as og_panels » og_panels to override access function from panelizer
StatusFileSize
new1.02 KB
new2.02 KB

Hi,
As I understand from readme.txt and sreynen told me to do I created a module as ogpanelizer (just give name for now) . This isn't working for me. I tried much but I am not good in OOPs . I tired to make a plugin.
attaching zip file of code. http://drupal.org/files/ogpanelizer.zip

And I find a other way to do so. I use hook_menu_alter and change callback function for it. I am also attaching that module too. sreynen told me Its not a sustainable way. So Its dropped. http://drupal.org/files/og_panels.zip