I want to build a multi user website where my users register and their account is created.
After sign up the user gets a specific url to build his website. Like. Mysite.com/user1
Now the user can login to the control panel and publish his data. Eg he has created a faq page.
His faq page should be available like
Mysite.com/user1/faq
I've done everything but this faq page building does not work at all.
I check the user for existence in the DB and route to his page in the routes.php file
:any = home/loader/$1
And in loader.php I fetch the details and display his welcome page, for the faq page, I have created a function in the loader.php controller as
Faq()
And built a custom view for it but now when I try to access the page it only loads the welcome page.
I tried all methods but it does not work.
I suggest you have a look at the Tutplus
http://code.tutsplus.com/tutorials/basecamp-style-subdomains-with-codeigniter
It explains how to work with wildcard routing in codeigniter
Related
I readed doku and search about middleware on october informations, but nothing find what me can help.
My Problem:
I created Plugin and use RainLab User Plugin for Frontend Editoring of Content.
Frontend Content spilt up on Section, Group and Article.
Single Users become different access: hiddem, show, edit and more for sections and articles.
The site works with one plugin on content load dynamic.
How i can load content for single user by access config?
My solution:
I added on backend some functions to give access for users.
rainlab user content access
All access configs saved and works.
My idee is to create middleware to load content but i find nothing what can help me.
Docu tell me you can create middleware but middleware load all time on frontend, backend, all pages on website. This is not good solution.
https://octobercms.com/docs/backend/controllers-ajax#controller-middleware
In addition comes if i debug on middleware, so rainlab user functions not working, no informations about url request.
Why add middleware when you must load and create all classes and functions by himself??
I need middleware only for frontend and only for plugin or component.
I hope somebody can me help to find another solution or idee to fix it.
I think there is nothing left but to implement the content access in respective component on onRun function. :( and problem by this solution is: return Redirect not working outside a class or function (only on onRun)
There is Problem with your approach, as you want middleware and also you want to make sure it run for specific plugins and component. middleware worked based on request and request may have information about URL etc. but not about plugin & component etc so it can not determine when to run based on plugin etc..`
So you may use Different approach. and it will work with Frontend also with ajax requests.
You can create component inside your plugin, It will assessment all the access for logged in user if user is logged in. if user is not logged in you can provide different assessment access.
Now you need to add this component to your layout and now all pages which are using this layout have this access information from the beginning.
Now this component inject access information to page, So your Page and plugin's components can have this information readily available. now from your component inside onRun you can handle redirect at very top.
Component is not to define access, its just inject predefined access information which is in database [ as you said you use users plugin so fetch it and inject it ] to the page
Component will be specifically just inject access information to page. And that Component will be on layout so. it will automatically trigger for that layout pages. so it will executed first and based on that you can decide how to use it. you can also render conditional component based on that. as you can have access information in markup part as well so
if you have any doubt or questions please comment.
I am a novice in joomla. Now I use joomla to make a website , and I need the the website first page is a login page(login form) , only users registered will see other pages.(like joomla admistrator)
I have looked for others similar articles,
change default joomla login page,
but I still have a little confused,
my template default entry is index.php and it has other associated components and menus.
How to set the default page is login?
and I also know that I should setting up access level of all my menu items as registered.
Will you have any good suggestions?
Thanks!
a:
You could use the lockdown feature of Joomla usually used for closing the site.
System > Global Configuration > tab - Site
Site Offline = Yes
Then save and logout and look at the front of your joomla site. You will just see a login box which you may want to style.
This is a little of a hack way to do it quickly
b: this is the suggested way
You should mark all your menu items with the Access : "Registered"
Then make a second home page and mark this Access : "Guest"
You then put any content you like on this new page and a login module box.
This way people not loged in will see the Guest page and all when logged in will see Registered pages. For example if you had a menu on the page all the links will now show in the menu when logged out they did not, as Guest does not have permission.
Is this what you want?
I have researched for this solution all month but I didn't get the right answer for my page. Please take a look and give me suggestions.
I have the admin page and the view is Dashboard.
I have tables are Staffs, Customers, Comments, Contacts....
I created these page to show data on view successfully for each of them.
NOW, I want to make the dashboard page to view each 5 top new Staffs, Customers, Comments....were being added to system. The summary page. My Dashboard page will be my main page (when access the domain, it will direct to dashboard page).
My question are:
Where should I create the Dashboard page in?
How can I take the data from Staff Controllers, Customers Controller....in the dashboard page. Dashboard page is not include in view of these above controllers.
I use cakephp 1.3
Please give me the best suggestion for this. Thank everyone much !
First of all it depends upon the way you wanna go ahead:
1) Where should I create the Dashboard page in?
Its totally upto you where you want to create the page, but it should ideally be the page to be redirected after the admin login.(BTW its a foolish question to be asked.)
2) How can I take the data from Staff Controllers, Customers Controller....in the dashboard page. Dashboard page is not include in view of these above controllers.
You can do that in 2 ways:
a) Create common functions for these in their respective model and just call those into your single function created for dashboard.
b) Create functions in their respective controller and import the controller and use these methods in the dashboard function(But avoid this approach as long as you can as it will load unnecessary controller class files).
Hope it helps you.
I have a Wordpress page /users and it displays a list of all users created. Each user has a link to its profile page. What I need to do is create that page. I want it to go like this /users/{user_id}-{first_name}-{last_name}, for example - /users/1-john-doe. I have a template for /users and also for profile pages. Question - how do I properly make a page with that profile template so that it would have the url described above? The page does not need to select the user automatically, it needs to pass the user slug so I can read it in that page and query for that user (as a variable or something).
Thanks.
What you are looking for is the WordPress Rewrite API.
This allows you to define a new "endpoint" for your URL's, and allows you to pick up the variable from the URL via built-in WordPress functionality.
A great article on it can be found here: Custom Endpoints
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!