I've installed Drupal to have a basic user registration layer. Now I need to code some PHP code in a blank page, how I can achieve this in Drupal? I need to know where I must put my PHP code.
Thanks a lot
Edit.
Basically I need Drupal only for user authorization. After a user logged into the system I want to show him a table with some data. This table was managed with JQuery.
for what you want to do I think it's not necessary a custom module, but if so, it's not so hard to do, but you can allways use some existing drupal modules mixed together to do what you want.
You will need:
Display Suite and
Login Redirect module
Basically I need Drupal only for user authorization. After a user
logged into the system I want to show him a table with some data.
For this purpose you can use Login Redirect module to redirect user to any page you want.
Now I need to code some PHP code in a blank page, how I can achieve
this in Drupal? I need to know where I must put my PHP code.
For this you can use Display Suite. Display suite or simply DS comes with a new a new Text Format: "Display Suite code". This text format allow you to add some custom code to your pages (javascript,php,etc)
you should learn to develop Drupal modules
with hook_menu you can make page
and with hook_form_alter you can edit registration form
but in drupal 7 you can manage registration fields
and also with rules and views modules, you can manage registration and user list without PHP coding
You will have to create a module in order to add php code to drupal. Try this to understand better what u need to do https://drupal.org/node/1074360
Related
I am new to Joomla component developement and currently fighting with certain basic design patterns!
Lets say, I am developing a component where users can enter simple notes into their personal notebooks.
On calling the view "index.php?option=com_notebook&view=notes" I simply show a list of all note entries of the user. No problem so far, this is working fine.
Now I want to extend my component with the following feature: on opening the view "index.php?option=com_notebook&view=notes", I want to check if the user has already created a notebook before. If yes, I show all note entries, if not, I want to load a different view which contains a form to create a new notebook with certain options.
But how can this be done in a clean way?
For sure, I just can implement the form within the view "notes", but this is not the clean way, isnt it?
I also tried to override the function "display()" of the main controller and set the view manually if no notebook exists. But if I do so, I have to handle all calls to other views of my component manually within the function "display()". To solve this, I created a copy the original implementation from the class "JControllerLegacy" and changed it to my needs - this is working - but is this really the best way to handle problems like this?
So I ask you, what is the best approach to solve this problem?
Thx a lot!
According to me the best solution of your problem is to provide "New" and "Edit" button to your notebook listing page and create edit view of notbook. Same as Joomla has articles and article views.
So, As you mentioned above if use dose not have any notebook then he/she can create a new notebook using that "New" button. when user clicked on "New" button he has blank form where he/she can create new notebook.
here is the example how to create listing and edit view in Joomla. Hope this will help you.
https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_backend_actions
I converted a site from 1.7 to 2.5, and all is really just about done, but I'm having one issue. I want to use these two custom K2 templates that existed in the previous version for both user registration and user profile because they were using K2 as the user registration mechanism.
I've configured K2 to Enable K2 User Profile:
but for whatever reason, when I navigate to index.php?option=com_users&view=register it's still grabbing the default registration form. Now, I thought it was maybe the URL, but the old 1.7 system is using the same URL. So, with some debugging I found that when the layout is told to search for a file, the K2 path isn't in the array.
What did I do wrong here?
NOTE: I also tried configuring the User Manager so that Allow User Registration was set to No, but I just get a 403 then because it's just not overriding with that K2 template.
UPDATE
As I stated in the comments, for whatever reason I don't have a K2 registration menu item type. However, the weirdest part is that the 1.7 version didn't point to the K2 registration either.
A little more background. This is a really hacked together system. The menu is actually built with a Jumi module that is straight forward custom and when the user is logged in the link that is used for the profile for example is this:
index.php?option=com_users&view=user&layout=form&id=3
and the register link, which is also custom (i.e. it's a link on a custom view) is this:
index.php?option=com_user&view=register
So, in short, I don't know enough about the Joomla navigation system to understand how to get those links to reroute to the K2 views that reside /components/com_k2/templates folder.
UPDATE
I put the register.php view that existed in /components/com_k2/templates folder into the /templates/tmplname/html/com_users/register folder and renamed it default.php so that the default user registration navigation would choose that view. And it did choose that view, no real surprise, but it also failed on a line like this:
<?php if(count(array_filter($this->K2Plugins))): ?>
because K2Plugins is null and that's not allowed for the array_filter function. I'm guessing this is because if this view were inside the com_k2 folder, like its original location, this would be available. I'm trying everything I can think of now.
It also threw on this line:
$this->K2Params->get('recaptchaOnRegistration')
because K2Params is null so of course get isn't available.
I found the problem, finally! The /plugins/system/k2/k2.php was catching the onAfterDispatch method for the navigation of com_users. If it was com_users and register or profile then it redirected and leveraged a different view. Well, the problem was that the old code said com_user instead of com_users. Silly!
I've been stuck on the proper way to do this for a while. I want to add a new page to the Magento user account on the front end after log in/creation. There is some information we would like to gather from our customers separate from account creation. The page needs to be dynamically generated, as it will pull information from the database, so CMS is not an option.
I know there's a template .phtml file I'll need to create. I also know where to override customer.xml to have the link show up.
But, I have NO idea how to make the page show up (I can add the link, but it goes to 404). I assume there's some sort of xml reference to associate url to file, and the template to use. If someone can point me in the right direction, I can probably reverse-engineer the format.
I also don't know how to properly use Magento's existing functions to grab the information on submit. I want to show the same page after submission, with info in fields ready to change. Can I/should I just use the same .phtml template file to process the form submit?
Thanks!
Create a custom phtml page with your desired functionality.
Create a cms page and call the .phtml page from within it as
follows,
{{block type="core/template" template=".../.../yourcustom.phtml"}}
3.Your problem solved.
I think you have a fair idea on how to handle the cms page to get your desired functionality.
You can customize the phtml file of account information page ../customer/account/edit/
but to force filling this form you need to make module and add observer controller_action_predispatch and add method that check for the data you want and if not redirect them to the account information page
Let's say I'm making a blog in Drupal 7, and I want my end user to see a link: "Add Post", and when he clicks on that link he can add a new content. But instead of the default administration page, is it possible to create a new one, which has just the post title, tags, message and etc?
I've been searching for 2 days now, founding nothing about where to start/how to start a specific administration page instead of the default one.
You will have to create a specific module for that which will:
define the blog post editing form you want to have
define a page through a hook_menu function that includes the form
define a menu entry for it in the administrative menu
etc.
You should really get a little more into extending drupal by reading some pro drupal 7 book.
At least start reading http://drupal.org/node/1074360
Another very good starting point is the drupal "examples" module, which provides example code for most things your modules need to do:
http://drupal.org/project/examples
You could probably do all you need to by adding a template for the blog posting page to your theme. This lets you customise the display of the form, without needing to get too deep into Drupal programming.
Alternatively, you could create a module to replace the default blog submission form with one if your own design.
The theming and module design guides on the Drupal website give lits if detail on both these approaches.
James
you can have a different theme for management section, you can have multiple permissions depending on role, you can customize any page using ***node.tpl
Every add/content_type is a form. Forms can be altered with hook_form_alter or hook_form_id_alter.
If you want to have different fields that are shown for different roles, first see if it could be done on the admin/people/permissions page, if not write extra if conditions inside the form_alter.
e.g. check user role:
global $user;
// Check to see if $user doesn't have the administrator role.
if (!in_array('administrator', array_values($user->roles))) {
// Alter the form
}
You can check the form variables with dpm($form) when the Devel modules is enabled.
Im using Drupal 6.19 and have used the webform module in Drupal to create a form on my Drupal site.The form shows up in the navigation menu.
Is it possible to restrict access to the form to only a particular role ?.
That is, i want only users belonging to a particular role to be able to see the form link in the navigation menu and be able to access it.Users belonging to other roles should not see the form link in the navigation menu and also should not be able to access it.
Can this be done ?
Please help
Thank You
as always, there are several ways to skin a cat... :)
how about using the node privacy by role module? seems to do exactly what you are asking for. you can set it by content type or on a per-node basis, if you need control that granular.
other modules to look at at: content access and webform submission acl
hope that helps.
Probably you should check hook_access to do it manually. Or look at the content access module if it may help.