• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Question regarding the canEditPost function

AndyB

Well-known member
#1
In my add-on called Rotate, I have created a route called 'rotate' and I use it in a template like this:

Code:
http://www.southbayriders.com/forums/rotate/?direction=cw&attachment_id=507566
I would like to allow the Registered user group to be able to rotate attachments, but only when they have edit permission for a particular post, otherwise I will throw an error if there is no permission. My question is there an easy way to see if a post can still be edited by a user by using an existing XenForo function?

PHP:
<?php

class Andy_Rotate_ControllerPublic_Rotate extends XenForo_ControllerPublic_Abstract
{     
    public function actionIndex()
    { 
        (add code here)
    }
}
Thank you.


Thank you.
 

Chris D

XenForo developer
Staff member
#2
Just call the "canEditPost" function from the Post model - you've already mentioned it in the title of your thread.