I was looking in the forum how to allow FEU user to have a simple CRUD for their own data. All the post I read was looking a little bit complicated. I just found a simple way to do this. No need to modify any .php file. Just some template management. That's all !
(maybe this solution was already posted by someone. So sorry for that and delete my post)
we just need 2 modules installed:
- FrontEndUsers
- CompanyDirectory
1/ create 2 new pages
We need 2 pages:
- One to list only the company created by the user (he can edit). Create the page and give it the alias "feu-company-list".
- One to display the edit and new form. Create the page and give it the alias "feu-company-edit".
Thats all for the moment. We will go back to the content later.
2/ create a new template for the feu-company-list page
We just need a new template to list only the company that the user created. Go to the companydir template option, and create a new "summary template". Name it "feu_editing_list". Just copy and paste the default (sample) template and add some new code.
- at the top put the code:
Code: Select all
{cms_selflink page="feu-company-edit" text="ADD NEW COMPANY"}
- Now find the first "foreach" loop: find the {foreach from=$items item=entry} and just after creat a new {if} condition to list only the records that match with the FEuser ID actualy logged. So put this:
Code: Select all
{if isset($userid) && $userid == $entry->owner_id}
- Add the edit button for each record to allow user to edit. Just before the first {/foreach} put the code
Code: Select all
{assign var="compid" value=$entry->id}
{cms_selflink page="feu-company-edit" text="Edit" urlparam="&compid=$compid"}
- Dont forget to close the {/if} condition just before the first {/foreach}.
3/ add tag on the 2 new pages we created
Now we have to put some tags in the destination page to work with our new companydir template.
- So open the first page "feu-company-list" (see 1/) and put the tag in the content:
Code: Select all
{CompanyDirectory summarytemplate="feu_editing_list"}
- Open the 2nd page "feu-company-edit" (see 1/) and put the tag in the content:
Code: Select all
{CompanyDirectory action="fe_edit" companyid=$smarty.get.compid}
4/ Almost done !
Ok now we just need to put somewhere the link to the "feu-company-list" so that the user logged can access his personnal company list. I decide to put it just below the FEU message saying you are loggedin.
So go to the FEU module administration. Select the "logout form template" and put at the bottom:
Code: Select all
<p>{cms_selflink page="feu-company-list" text="admin your company"}</p>
Ok thanks to read my post. I will be glad if u can test this and go back to me if u have some questions or if i did wrong thing.
This method work with the CompanyDirectory module but it can work with all other module that allow FEU to modify data.
Hope this will help you.
See ya !