Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Remove "already leveled creature today" text?
I'm making simple profile pages for the adoptables on my site using their levelup pages, but the text that pops up when a member has already leveled a creature kind of removes the whole thing.
Basically what I've done is added new comments to the levelup view file, and I want that to display even if a member has clicked the adoptable that day, so is there an easy way to disable the "already leveled creature today" text? I still want the adopts to only be clicked once per user though. |
#2
|
||||
|
||||
My work around for this was way too hacky in bypassing the 'error' of 'already leveled creature today'. I'm curious as to HoF's answer.
Perhaps you can glean something out of what I've got (though I toned down the message variable to cut out most of my profile stuff that'd be too custom, left in the usual data) - Note that this is JUST the click function in levelup.php, not the whole file. Don't use it as is, try to understand it. @w@ Good luck! There are numerous reasons you can't use this as-is, mostly because some of it's been modified in ways unique to my site. I've change a few core page urls, so this part, for example - if ($mysidia->user->username == $this->adopt->getOwner()){ $manage_btn = "<a class='btn btn-sm btn-info' href='../../yournovu/manage/{$this->adopt->getAdoptID()}'><i class='fa fa-gear'></i> Manage Your Novu</a>"; } else { $manage_btn = ""; } - has things linking to a yournovu/manage/ page, because my adoptables are called Novu, rather than whatever the original url for that link should be. I forgot. @w@ Stuff like that is different. I also don't know if the system originally kept track of pet birthdays, so that may break, etc. And, all in all, I DON'T recommend what I've done to get the profile page to work. (I also added in some Javascript elsewhere that deletes the error title itself but that's not included.) And why don't I like my solution? Because it's still using what was there - throw new LevelupException($message); - and I just changed the $message. It's still an Exception being thrown and I'd love to rewrite the entire thing and avoid using exceptions but I don't know how. It's expecting an error to be thrown if things are just so, and I'm just making it look like there wasn't an error. . . . Basically, HoF, I think what we want (for future releases) are profile pages for our pets that are the same no matter what - whether you've visited the pet or not, whether it's yours or not, and whether it's frozen or not. Rather than change the entire page, just add in a small memo to the pet's profile that says "Thanks for visiting this pet", a link back to the management page if it's your pet, and/or a notification that the pet didn't gain experience because the owner has it frozen.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 12-19-2015 at 03:53 PM. |
#3
|
||||
|
||||
I'm very curious about this as well as I've been trying to do this for a bit now (but 96% fail with understanding PHP).
__________________
My Mods Site (1.3.4, 2020 Mods) |
#4
|
||||
|
||||
Thank you Kyttias! I'm definitely going to see if I can incorporate any of this into my own site's code! (:
|
#5
|
||||
|
||||
Nevermind, I got it working! For anyone who, like me, is not super code savvy but trying to get the image to display in the levelup.php file I used this (I'm sure I could have done something more effective but this works perfectly fine so *shrug*!):
PHP Code:
__________________
My Mods Site (1.3.4, 2020 Mods) Last edited by Abronsyth; 12-22-2015 at 11:57 AM. |
#6
|
||||
|
||||
Installed it onto my site but haven't had a chance to change much. Super late right now. Gonna fiddle with it more tomorrow! Thanks so much Kyttias! And thanks Abronsyth for the image code. c:
|
#7
|
||||
|
||||
Basically, the error is still being thrown. You could use a bit of jQuery to cover it up (just add it alongside the rest - it's in script element tags, so it won't be seen like ordinary html - I included it after the last </div> I'm using on my pet's profiles before even closing the message variable). Of course, this'll only work if you have jQuery as part of your theme's template (Bootstrap theme definitely does):
Code:
<script>$(\"h2:contains('An error has occurred.')\").remove();</script> And, incidentally, you can change your error message text site-wide from lang/lang_global.php -- so if you happen to change it there, be sure to update the snippet I just provided to reflect that. (** And yeah, Abronsyth, I forgot to include a pet image -- my pet images are rendered with some custom code, so I took my bit out but couldn't remember the original -- thanks for providing that snippet of code!!)
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. Last edited by Kyttias; 12-24-2015 at 04:05 PM. |
#8
|
||||
|
||||
Thanks so much Kyttias! I'm having trouble with removing the error part. I think the jquery isn't being enabled maybe. How exactly do I enable jquery on my site?
I've tried adding this to my theme's header.tpl but it's not working: HTML Code:
<script src="{$home}/jquery/jquery-1.11.3.min.js"></script> I've also tried the hosted links from google and microsoft but they're not working either. :c |
#9
|
||||
|
||||
Weird, but, check that the jQuery library is being loaded with your pages. This really is as simple as linking it and using it. Is the link you added to your header shower up when a page loads/you sure you added it to the right theme? The file does seem to exist in that location on the live version of your site, but a link to it does not appear when I load a page - but maybe you're testing elsewhere.
But, perhaps more to the point, your page titles seem to be in h1 not in h2. Change the code I gave you so it knows to check an h1 tag instead.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it. |
#10
|
||||
|
||||
Oh GAWD that was probably the problem. They were h2 and not h1.
I removed the jquery link because i noticed my pages loaded slow after it was added... Like really slow. But that's probably why you didn't see the link anymore. Ahh, thanks! I'll see if it works now. But if it's still slow I think I'll just change the error message instead... Unless there's a way to make it not cause pages to be loaded so slow? Lol Thanks again, you're amazing! <3 |
|
|
What's New? |
What's Hot? |
What's Popular? |