Participating in Product Hunt Global Hackathon — Days 15 to 19

Kristian Ivanov
HackerNoon.com
4 min readNov 21, 2017

--

I can’t believe that it’s been 5 days since the last entry here: https://hackernoon.com/participating-in-product-hunt-global-hackathon-days-13-and-14-137072e1d05c

All of those days I was primarily focused on adding a user management module to allow registration, login, logout, forgotten passwords, etc.

One of my teachers used to say that we should start writing code from scratch, only when there isn’t a ready solution that we can already use. I hate doing user management. It is not because it is hard, but because it has so many aspects and things that it includes — the user has to be able to log in, logout, register, delete his account, change things about his account, be able to log in with social networks, there should be different roles, some pages should be disabled for some roles and a dozen other things. The list of functionalities only grows when you add subscriptions and payments… Because of those things I decided to buy a user management module, that I can just include in my project and be done with it. At least this was my plan. It turned out that not every piece of code, sold on Code Canyon is good.

I will give you a few examples of not so good ideas from the module I bought:

The module support localization (wohooo). However it doesn’t have a default language, so the the content is filled with empty spans. This was fixed rather easy when I edited all of the needed configs. The biggest problem with their localization is that the keys in the language files go from ‘ctn_1’ to ‘ctn_475’. When you see in the code lang[‘ctn_183’] you have no idea what the **** the content of the given span, li or p tag actually is. I am only mentioning it because there were several ones that weren’t using the appropriate text. Debugging it was fun.

My next problem is with their sidebar. The sidebar is entirely hardcoded piece of li items. Every li item has a ternary to check if the user has the appropriate role to see the link. Don’t think that they do it in any logical way or anything. It is, again, hardcoded.
$this->user->info->admin || $this->user->info->admin_members
I guess I can not make any other user roles and allow them access to specific webpages.

As a bonus, the sidebar has a dropdown that shows the user all of the pages that he has no access to. Upon clicking any link in that dropdown, it just opens an error view saying that the user isn’t allowed there. Naturally I deleted that dropdown. I don’t think that anyone needs to see links to pages that he or she can’t reach.

Another good example is how they allow checking if the user is logged in other files. I will summarize it:

1. copy two files to your root folder. Weird. I put them where I wanted to and edited the path variables in them

2. copy the code from one of the files to every file that you want to protect for users. The file must be a .php file and not .html file. The second sentence is so obvious that I don’t know why it is included. However my main problem is with the first one — why do I need to copy paste the code? can’t I include it or require it and keep the code in only one file, so when I edit it I won’t have to edit a dozen other files? I might seem picky right now, but there are a lot of places in the whole module where code is copy pasted, instead of separating it to a class, function or any other separate instance to be more easily maintained.

The module offers paid support, so maybe it is intentional. I have no idea. I know however that it took me nearly four days to install it and tweak it work the way I wanted to. I also know that I will have to refactor the whole thing to make it maintainable to some extent, but I will do it after the hackathon is over.

It may not seem like it but the module I am ranting about actually saved me a lot of development time. Yes, there are problems with it, but I will be able to fixed them after the hackathon is over and considering its deadline, I am happy with anything that can save me some time. So it isn’t all bad.

The user management isn’t even live yet. It will be in a day or two when I finish the other user functionalities.

Next

You can check my plans for the near future here.

I will try to make a new article late (1–2 AM) in the evening today or tomorrow when everything else is done and the Beta is officially live.

Prologue

If you are a participant in the hackathon I would love to hear your impressions of the hackathon and this article and whether or not our journeys so far had anything similar.

The previous articles can be found here:
Participating in Product Hunt Global Hackathon — Days 1 to 11
Participating in Product Hunt Global Hackathon — Days 13 and 14

And of course anyone is more than welcomed to subscribe for Gamayun here — https://www.producthunt.com/upcoming/gamayun, test it, tweet to it and whatever else you can think of :)

--

--

Kristian Ivanov
HackerNoon.com

Mobile and rarely a web developer, crossfiter and a music junky…