Modifying already existing module through plugin?
Hi again ^_^
I've been at this for an hour or two trying different stuff. But all I've gotten to is 3(4) lines of code that sorta does what I want but not.
I've been trying to edit the already existing About Module when viewing Profile page. However all I do is pretty much override the profile page instead.
public function ProfileController_Render_Before($Sender, $Args) {
$Sender->View = $this->GetView('/modules/userinfo.php'); // Overrides everything inside the profile view (not what I wanted)
//$Sender->Render('OnBasicInfo', '', '/modules/userinfo.php'); //Internal Error
}
As you can see it doesn't exactly override the right place... Again there is probably something I havn't understood correct.
And all I seem to do lately here is ask questions.
Even so I really appreciate the warm help I've been getting! With that said please help again.
Best Answers
-
peregrine MVP
not an answer to your question but an alternative.
public function UserInfoModule_OnBasicInfo_Handler($Sender) {
echo Wrap(T("Warframe"), 'dt', array('class' => 'My Warframe')); echo $Sender->User->Warframe }
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
2 -
peregrine MVP
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
6
Answers
I'm not quite sure what your question is, ut I assume you want your info at another place than it is right now. There are 4 ways that might work.
I think, you'll end up with 4. Copy
applications/dashboard/views/profile/info.php
to/theme/yourtheme/views/profile/info.php
and edit yournew file. Just add your<dd class="Value Warframe"><?php echo $this->User->Warframe; ?></dd>
where you need it.You only have to enable your new theme to see your newly created field in user profile.
I see I didn't explain my self enough. What I've been working on is a plugin that changes.
1 The Registration form to have 'Warframe' option (Done thanks to peregrine)
2 I want it to be shown in the already existing About box. (This I fail to do)
I've tried some new attempts but they still seem to be in vain.
public function ProfileController_Render_Before($Sender, $Args) {
$UserInfoModule = new UserInfoModule($Sender);
$UserInfoModule->View = $this->GetView('/modules/userinfo.php');
}
As you can see I've been trying to get hold of the Module of the '$Sender' which I would assume is the current one on the Profile page. But I don't seem to be able to change its view. Yet another failed attempt.
Simply put I want to be able to through my plugin to override the current 'view' of the UserInfoModule.
No, it was my fault! I must have recognized it. I made the same error and @peregrine gave me a useful hint vanillaforums.org/discussion/comment/185882/#Comment_185882
You must make sure that your view isn't rendered to "content" but to "asset". Sadly I cannot tell you how to do it... :-(
not an answer to your question but an alternative.
public function UserInfoModule_OnBasicInfo_Handler($Sender) {
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
http://vanillaforums.org/discussion/13278/where-to-over-ride-a-module
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
So thats how I use the event properly, thanks! Not what I was looking for but it'll do until I figure out how to do otherwise.
all you are doing is create a new instance of the module an setting a non-existent property.
You could copy userinfo.php and place it in your theme's
views/modules
folder or your theme'sviews/dashboard/modules
folderYou first bet is to actually look a the code in class.module.php that will tell you exact the order of which it find the view.
Another is to remove the module form the panel an load a custom module.
unset($Sender->Assets['Panel']['UserInfoModule']);
$Sender->AddModule('CustomModule', 'Panel');
Another somewhat hacky method is to use the public
Path()
method. You can pretend the module is in a different locationIt will then look for 'yourtheme/views/modules/userinfo.php'
grep is your friend.
I ended up doing it a little different though, since your way seemed to block my path for an extra field:
Simply wanted to add this if anyone should run into same problem.
T($Warframe)?
(T($InName) ?
why the Translate?
don't you want this?
echo Wrap($Warframe, 'dd', array('class' => 'MWarframe'));
echo Wrap($InName, 'dd', array('class' => 'Ingame'));
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Well since I'm new to php so don't know what T() does, I simply assumed it converted stuff to readable string or something. Eitherway it works ^^
Do you know it now? It's quite comfortable: put your string output into T() and you can override it with a language file. See the wiki for localization.
But some functions that accept strings automatically send them through the T() function, so that you do not need to do that.
well in this case there appears no reason to translate $Warframe unless you are maing it generic and storing values always ash , etc
and wanting to translate e.g. ash to bash, or ash to cash, or any other of the warframe options.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
or in hgtonight's case, ass to class ....
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
:O
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.