New Widget Area named after logged user ID
Hi,
I've been using Atahualpa for a long time but never had to post something in the forum as I always find what I'm looking for here.. What I want to do in my new web site is to automatically create a new widget area for every user that subscribes to it and name it after his/her id and last name (example: 2 Smith). I can get the user info with this piece of code: php global $current_user; get_currentuserinfo(); echo 'Username: ' . $current_user->user_login . "\n"; echo 'User email: ' . $current_user->user_email . "\n"; echo 'User level: ' . $current_user->user_level . "\n"; echo 'User first name: ' . $current_user->user_firstname . "\n"; echo 'User last name: ' . $current_user->user_lastname . "\n"; echo 'User display name: ' . $current_user->display_name . "\n"; echo 'User ID: ' . $current_user->ID . "\n"; What I'm looking for is the way to place the data from $current_user->ID and $current_user->user_lastname inside the command (bfa_widget_area('name=My new widget area') for creating the new widget areas. I'm using Wordpress 3.0.1 and Atahualpa 3.5.3 My php skills are very very limited... Thanks |
I would advise against this even if you found a way to do it. Let's assume you found a way to create the widget area. Then you could potentially have many widget areas showing up in Appearance>Widgets which would eventually get hard to navigate and you would have to populate those widget areas with widgets which would eventually add a lot of overhead on your server causing performance issues.
With that said what is your purpose for creating the new widget areas for each subscriber? Maybe there is a better solution for what you want to accomplish. |
Hi Larry and thanks for your reply.
The purpose is to give each subscriber a different update only for him.. A text widget will do just fine.. There will not be many subscribers so I don't worry about server load or having too many widgets. I couldn't think of a better way to do this. I'm open to any ideas or suggestions you may have. Thanks |
I'm not sure what you want to put in the update, but why not put some code in a text widget and tie off the user that is logged in - you will need the exec-php widget or another widget like that but you could use something like this
HTML Code:
<?php global $current_user; |
Hi juggledad. Thanks for taking the time to reply.
Here's an example of what i want to do: Let's say that you and Larry are my subscribers. When you log in you can both see the posts in my blog but i also have a picture that is only for you to see and another picture that is only for Larry. I want to put this pictures in the sidebar using text widgets but I don't want Larry to see your picture or you to see Larry's. Thanks |
HTML Code:
<?php global $current_user; |
you could even try this
HTML Code:
<?php global $current_user; |
Or perhaps you could use a membership plugin such as s2Member to restrict access to certain areas.
|
I have tried s2Member but ended up using MemberWingX instead.
juggledad thanks for the above codes. This is a way of doing what I want but i will have to edit the code each time i have a new subscriber. I will try to automate the proccess by trying to create widget areas for each user. Thanks |
Try my second idea, one widget, you just have to add an iimage for each user
|
All times are GMT -6. The time now is 08:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.