Frank Vèssia Posted January 27, 2015 Share Posted January 27, 2015 It's possible to hook the $comments->render() function to show more data based on some default value of the comment?My goal is to display the user's profile picture and i can get the picture using the "cite" value of the comment Link to comment Share on other sites More sharing options...
adrian Posted January 27, 2015 Share Posted January 27, 2015 If I understand correctly, there is no need to hook - just don't use the built in render method, but instead generate the output yourself. http://processwire.com/api/fieldtypes/comments/ and scroll down to the "OPTIONAL: Generating your own output" section. Does that cover your needs? Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 27, 2015 Author Share Posted January 27, 2015 mmm yes this is an option but I just wanted to use the render buit in function and code just the part I need to add Link to comment Share on other sites More sharing options...
adrian Posted January 27, 2015 Share Posted January 27, 2015 Not sure if the first line of your first post is a question or a statement , but renderItem(): https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeComments/InputfieldCommentsAdmin.module#L33 and render(): https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeComments/InputfieldCommentsAdmin.module#L88 are hookable, so it shouldn't be too hard 1 Link to comment Share on other sites More sharing options...
renobird Posted January 27, 2015 Share Posted January 27, 2015 I can post a working version of this tomorrow. I use page comments (with user profile images) as part of admin pages a lot. 4 Link to comment Share on other sites More sharing options...
Macrura Posted January 27, 2015 Share Posted January 27, 2015 @renobird, i would be keen on learning more about having comments as part of an admin page - is it possible to have comments right on an editor page? Link to comment Share on other sites More sharing options...
renobird Posted January 27, 2015 Share Posted January 27, 2015 Yep. I'll post a screenshot of a process module that has a comments sidebar when I get to the office tomorrow. 1 Link to comment Share on other sites More sharing options...
renobird Posted January 27, 2015 Share Posted January 27, 2015 Here is a quick screenshot of an admin page we use to manage the initial hiring process of new employees. The module hooks into FromBuilder and pulls in entries that are associated with the page. So all the information on the left is from a FormBuilder entry, the sidebar is a little more typical and just made up of the fields assigned to the template. I'll post more about that later. We don't allow users to edit the comments, because they are part of the document trail, but they have a chance to review them in a modal before the actual submit happens. The "notify of comment" pulls in a list of people with particular roles. I'll post the code a little later, I need to put out a small fire first. 6 Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 27, 2015 Share Posted January 27, 2015 It would be really nice so see how you're doing some of these "custom" admin stuff. It's not your first screenshot, that made me curious about this. 1 Link to comment Share on other sites More sharing options...
qtguru Posted January 27, 2015 Share Posted January 27, 2015 Renobird, that's some dope admin UI.................................. wait a minute renobird...........renotheme figures. nice admin ui 1 Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 27, 2015 Author Share Posted January 27, 2015 I'm looking forward to see how to implement the avatars into comments Awesome design here.Did you have the chance to play with the new comments system? I'm trying to show up the votes also but I'm having some issues, they don't display into comments using the options inside the render array. I asked here https://processwire.com/talk/topic/8912-display-votes-on-new-comments-system/ 1 Link to comment Share on other sites More sharing options...
renobird Posted January 27, 2015 Share Posted January 27, 2015 Thanks. I do a lot of custom admin pages here. Looking now I have 10 Process Modules that create custom admin functions. Some are simple, some a super complex. I'll get back here soon with some code examples. Sevarf2, Most of the things I've built that use comments were built long before the new comment system. 2 Link to comment Share on other sites More sharing options...
renobird Posted January 28, 2015 Share Posted January 28, 2015 Here are the 2 methods related to comments from the Process Module in the screenshot above. You can do pretty much the same thing in a template instead of a module. Sorry I don't have time to explain further, or put it into a more complete write up. Hopefully you can pick that apart and get what you need. 1 Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 28, 2015 Author Share Posted January 28, 2015 Thanks I will check the code Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 28, 2015 Share Posted January 28, 2015 Sorry I don't have time to explain further, or put it into a more complete write up. Hopefully you can pick that apart and get what you need. Just one small thing, do you use InputfieldMarkup or hooks or some custom fieldtype to inject this stuff into the template? Link to comment Share on other sites More sharing options...
kongondo Posted January 28, 2015 Share Posted January 28, 2015 That's the beauty of ProcessModules...you can pretty much throw anything at it and it will output it....plain HTML, whatever. I have had a quick look at the code and it's pretty much plain HTML in many places...added to that, some CSS to style it... 1 Link to comment Share on other sites More sharing options...
renobird Posted January 28, 2015 Share Posted January 28, 2015 LostKobrakai, Forgot to mention, the reason it's all returning markup is that when I build the form, the comments get added like so: // Comments $field = $this->modules->get("InputfieldMarkup"); $field->markupText = $this->renderComments($page); $form->add($field); 1 Link to comment Share on other sites More sharing options...
renobird Posted January 28, 2015 Share Posted January 28, 2015 Here is a paste that shows how the entire sidebar gets built. There's really nothing too fancy here. Pulling in specific FormBuilder entries and allowing edits that in turn update the associated page gets a little fancier, but nothing all that complicated really. There are certainly other ways to build that sidebar, but I needed to have a lot of control over the settings, and the template has a lot of other fields that are specific to another part of the process, so I can't just foreach the fields. 1 Link to comment Share on other sites More sharing options...
Spica Posted September 21, 2015 Share Posted September 21, 2015 Is there any hook after a comment is posted possible? Cannot find any. (Mabye too late) Link to comment Share on other sites More sharing options...
arjen Posted March 7, 2016 Share Posted March 7, 2016 Here are the 2 methods related to comments from the Process Module in the screenshot above. Here is a paste that shows how the entire sidebar gets built. Hey renobird, the content in both pastebin links seem to have been removed. Any change you can upload them (again)? Maybe a gist? Link to comment Share on other sites More sharing options...
renobird Posted March 8, 2016 Share Posted March 8, 2016 Hey renobird, the content in both pastebin links seem to have been removed. Any change you can upload them (again)? Maybe a gist? Hi arjen, I'll dig those up again. Not sure why I would have put an expiration on the pastes. 3 Link to comment Share on other sites More sharing options...
arjen Posted March 10, 2016 Share Posted March 10, 2016 Thanks Tom! Looking forward Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now