What's the easiest way to create a testimonial page in Drupal ?
I need the users be able to add a comment on the bottom of the page, and I need to approve them before they can be published.
I could use views + webform module for it ? Or is there something simpler ?
thanks
Create a content type called "Testimonials" and set it to default Unpublished. Call the Title field "Name" and the body field "Testimonial".
Create a View called testimonials with a page attachment that lists out nodes of type "testimonial" with a filter for Published = Yes. Set the path to "/testimonials".
Use the Form Block module (http://drupal.org/project/formblock) to put the Node Add form for the Testimonial content page into a block.
Configure the block you created to appear at the bottom of the testimonial page (your theme should have a "Content bottom" region, if not you'll need to add one by editing the theme's page.tpl.php and $theme.info file.
To approve a testimonial, go to the content list, filter by Type: Testimonial and Status: Unpublished then use the checkboxes and the drop-down to change the status to "Published".
This will provide a page that lists testimonials, with an "add testimonial" form at the bottom of the page, and all testimonials must be approved before they will appear on the site.
If your criteria for a testimonial is just a block of text then creating a "testimonial" content type would work. You could allow users to create them but require admin approval to be published.
You can also change the access control for comment approval
Edit:
This was going to be my follow-up comment when you clarified that you wanted a form at the bottom of an existing page.
I don't know if this works, but try
viewing the HTML source of
/node/add/testimonial in your
browser and copy everything from
<form action="/node/add/page"... to
the closing </form> tag.
Gah. That sounds hideously complicated. If you want a form at the bottom of an existing page then maybe the plugin you mentioned is the best option (but I haven't researched it).
Related
I would like to delete "All items" and "Add New" buttons inside a custom post type menu in Wordpress Admin.
I have a custom post type inside anotoher custom post type made with Tool Types.
But would like to only use the 'mainmenu' post type just as a menu where multiple post types are inside.
Mainmenu (custom post type)
- All items
- Add News
- Submenu (custom post type)
- Submenu (custom post type)
So right now the mainmenu is also a custom post type. I don't mind this as long the All items and Add new buttons are hidden.
This is probably the function you'd want to investigate:
https://codex.wordpress.org/Function_Reference/remove_submenu_page
You'd place that demo code in your functions.php file or a functionality plugin, and you'd just need to find the correct menu slug. It's probably just the portion of the URL after your site address for the pages you'd like to remove... So like this:
remove_submenu_page( 'post-new.php?post_type=your_custom_post_type' );
It's also worth noting that this method just removes the menu item from the menu.. It doesn't actually prevent someone from accessing those pages if they knew the URL. This might not be a big concern, but if you really want to lock things down you'd also want to check the users permissions for those pages.
No idea if this is the best way to do this but here is what i'm thinking.
I have a content type called 'Widgets' and each widget is a little piece of content. I wish to then have a generic 'View' which goes off and grabs all the widgets for the current page that the user is on.
Here is how I see it working in my head.. just not sure how to do it.
-When creating a content 'widget' the admin can somehow select a page they want it to appear on from a list taxonomy terms based on the site structure (as new pages are added they are also added to this tree automatically somehow)
-When a user then browses a page the generic view then works out what page the user is on and fetches all the widgets that have been tagged with this current page
Is this possible? and if so can someone please give me some pointers.
I figured this out, in the fields for the main pages you can add a term reference field that allows you to enter a new tag into the vocabulary.
The 'widget' content type can then select this new tag using a term select field. My view then automatically displays it because it is related.
I have created a form using add new content type and cck fields. I want anonymous users to view the menu item to this form but not the content. So when users click on the link they should get redirected to login page. I have granted the permissions of access all content. Any suggestions please.
Thanks
Kanwal
create node-{YOURCONTENTTYPE}.tpl.php in your theme, then write next code:
<?php
global $user;
if (!$user->uid) {
drupal_set_message('You should login before see this content type');
drupal_goto('user');
}
?>
//HERE CODE FROM STANDARD node.tpl.php of your theme
I would never use the theme layer for access control and redirection, as Nikit suggests.
You could simply create a normal menu link to 'user/login' with "Create content" as menu title. Drupal will automatically hide it when you're logged in.
An even better option, IMHO, is to use the Inline Registration module. As the module page says: "Inline Registration allows anonymous users to register via the node/add page, thus removing a step/barrier from the user actually publishing content." Try it, I think it's a huge usability improvement.
I really like the promote to home page feature of drupal. But what if I want some content promoted to a page other than the home page. Is that possible?
The "promote to front page" is a helper that puts the page in the /node URL. If your front page is not /node, the "promote to front page" won't really do what you expect.
If you want a list of nodes, then views will do the trick. However, if what you want is to put a node in a page that is another node as if it was a block, then I suggest you look at the "node as block" module.
From the module description:
This module allows those with the appropriate permissions the right to create blocks for each node. By default these blocks display the node title as the block title and the node teaser as the body.
I would suggest using Views for this purpose. For instance, create a taxonomy vocabulary with terms corresponding to the various pages you might want content to be promoted to. Then create or edit that content and tag it accordingly. In Views, use the taxonomy filter to display only the matching content.
As often, there are many ways to do that. The Flag module is a good way to put all kinds of markers on nodes. Another option is the Nodequeue module. This module allows the content creator to group nodes in 'queues' and control the order.
i tried to create a custom content type in drupal but unnecessary features like Title, Menu settings, and Revision Information, URL aliases come with it which i don't really want ..coz it doesn't mean anything to the user..
how can i hide all those things, just preserving the fields(say only 3 fields from CCK) that i want only for this custom content type??
thanks..
You can automatically generate titles using the auto_nodetitle module, which also enables you to remove the title field from the node submission form.
As others have mentioned above, most of the other form elements don't appear to non-admin users anyway.
With auto_nodetitle module, you can hide it, not remove it. Then, simply assign a title like "your-content-type-nid", so it will be different for each node (nid will be different).
That would be a better title than an empty one.
You will need to do a combination of things to do what you want. One of those is to add the module auto_nodetitle suggested by others. You can hide the "Body" by removing the "Body field label" from the edit screen for your custom content type. Lastly is that you will have to do the right settings for your CCK fields.
If you have CCK fields you want them to be able to edit and others you do not want them to edit, you will need to enable the Content Permissions module in the CCK section of the modules admin page. Once you've done that, you can go to the role permissions page and set what roles have access to which fields. While permissions can potentially hide CCK fields from the user, you can also control what fields are in the teaser, node, and RSS views via the "Display fields" section of your content type editing screens.
Menu settings, revision info and URL alias type info is admin stuff. If you create a new user that doesn't have admin permissions, I'm pretty sure they won't see it.
Can try some thing like below using hook_form_alter.
function my_module_form_alter(&$form, $form_state, $form_id) {
if($form_id='company_node_form'){
$form['menu']['#prefix'] ='<div style="display:none">';
$form['menu']['#suffix'] ='</div>';
$form['revision_information']['#prefix'] ='<div style="display:none">';
$form['revision_information']['#suffix'] ='</div>';
$form['author']['#prefix'] ='<div style="display:none">';
$form['author']['#suffix'] ='</div>';
$form['options']['#prefix'] ='<div style="display:none">';
$form['options']['#suffix'] ='</div>';
}
}
You might want to try the NodeFormCols module. It does several handy things, among them is to add a Manage Form button which allows you to hide most fields in an input form.